memcached protocol

References documentation for memcached protocol

RPC protocol based on memcached implementation.

Register memcached service address

RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181"));
registry.register(URL.valueOf("memcached://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash"));

Use in client

get service reference:

<dubbo:reference id="cache" interface="java.util.Map" group="member" />

or direct access by IP:

<dubbo:reference id="cache" interface="java.util.Map" url="memcached://10.20.153.10:11211" />

you can also use a custom interface:

<dubbo:reference id="cache" interface="com.foo.CacheService" url="memcached://10.20.153.10:11211" />

The method name is the same as the standard method name of memcached, just like get(key), set(key, value), delete(key)。

If the method name and the memcached standard method name are not the same, you need to configure the mapping

<dubbo:reference id="cache" interface="com.foo.CacheService" url="memcached://10.20.153.10:11211" p:set="putFoo" p:get="getFoo" p:delete="removeFoo" />

Last modified December 22, 2020: clean up website (6e41905afa)