feat: add support for meta memcache commands (#4362)

This is a stripped down version of supporting the memcache meta requests.

a. Not all meta flags are supported, but TTL, flags, arithmetics are supported.
b. does not include reply support.
c. does not include new semantics that are not part of the older, ascii protocol.

The parser interface has not changed significantly, and the meta commands are emulated
using the old, high level commands like ADD,REPLACE, INCR etc.

See https://raw.githubusercontent.com/memcached/memcached/refs/heads/master/doc/protocol.txt for more details
regarding the meta commands spec.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-12-24 15:33:24 +02:00 committed by GitHub
parent 6946820e56
commit a27cce81b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 291 additions and 22 deletions

View file

@ -0,0 +1,21 @@
from .instance import DflyInstance
from . import dfly_args
from meta_memcache import (
Key,
ServerAddress,
CacheClient,
connection_pool_factory_builder,
)
DEFAULT_ARGS = {"memcached_port": 11211, "proactor_threads": 4}
@dfly_args(DEFAULT_ARGS)
def test_basic(df_server: DflyInstance):
pool = CacheClient.cache_client_from_servers(
servers=[
ServerAddress(host="localhost", port=DEFAULT_ARGS.get("memcached_port")),
],
connection_pool_factory_fn=connection_pool_factory_builder(),
)
# TODO: to add integration tests

View file

@ -5,7 +5,6 @@ from redis import Redis
import socket
import random
import time
import warnings
from . import dfly_args
from .instance import DflyInstance

View file

@ -13,6 +13,7 @@ wrapt==1.14.1
pytest-asyncio==0.20.1
pytest-repeat==0.9.3
pymemcache==4.0.0
meta_memcache==2
prometheus_client==0.17.0
aiohttp==3.10.2
numpy