Memcached Protocol
Memcached Protocol
RPC protocol based on memcached 1.
Tip
Support for version 2.3.0
and above
Registering the 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"));
Referencing on the client side
Use on the client side 2:
<dubbo:reference id="cache" interface="java.util.Map" group="member" />
Or, connect directly point-to-point:
<dubbo:reference id="cache" interface="java.util.Map" url="memcached://10.20.153.10:11211" />
Custom interfaces can also be used:
<dubbo:reference id="cache" interface="com.foo.CacheService" url="memcached://10.20.153.10:11211" />
It is recommended that method names match the standard method names of memcached, namely: get(key), set(key, value), delete(key).
If the method names do not match the standard method names of memcached, a mapping relationship needs to be configured 3:
<dubbo:reference id="cache" interface="com.foo.CacheService" url="memcached://10.20.153.10:11211" p:set="putFoo" p:get="getFoo" p:delete="removeFoo" />
Feedback
Was this page helpful?
Yes No
Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)