RPC protocol based on memcached implementation.
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"));
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" />
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.