Memcached protocol

Feature description

RPC protocol implemented based on memcached. 2.3.0 and above are supported.

Memcached is an efficient KV cache server.

scenes to be used

Relieve database pressure, improve interaction speed, etc.

How to use

Import dependencies

Starting from Dubbo 3, the Memcached protocol is no longer embedded in Dubbo, and an independent module needs to be introduced separately.


Register the address of memcached service

RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://"));

Referenced on the client side

Do not need to be aware of the address of Memcached

use on client side

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

Or point-to-point direct connection

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

You can also use a custom interface

<dubbo:reference id="cache" interface="" url="memcached://" />

Where “p:xxx” is the standard p tag of spring

<dubbo:reference id="cache" interface="" url="memcached://" p:set="putFoo" p:get="getFoo" p:delete=" removeFoo" />

If the method name is different from the standard method name of memcached, you need to configure the mapping relationship;

The method name is recommended to be the same as the standard method name of memcached, namely: get(key), set(key, value), delete(key).

Last modified February 22, 2023: Merge refactor website (#2293) (4517e8c1c9c)