mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
feat: support memcache meta responses (#4366)
Fixes #4348 and #3071 Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
c88c707341
commit
966a1a46fd
9 changed files with 107 additions and 29 deletions
|
@ -6,6 +6,7 @@ from meta_memcache import (
|
|||
CacheClient,
|
||||
connection_pool_factory_builder,
|
||||
)
|
||||
from meta_memcache.protocol import RequestFlags, Miss, Value, Success
|
||||
|
||||
DEFAULT_ARGS = {"memcached_port": 11211, "proactor_threads": 4}
|
||||
|
||||
|
@ -16,6 +17,14 @@ def test_basic(df_server: DflyInstance):
|
|||
servers=[
|
||||
ServerAddress(host="localhost", port=DEFAULT_ARGS.get("memcached_port")),
|
||||
],
|
||||
connection_pool_factory_fn=connection_pool_factory_builder(),
|
||||
connection_pool_factory_fn=connection_pool_factory_builder(recv_timeout=5),
|
||||
)
|
||||
# TODO: to add integration tests
|
||||
|
||||
assert pool.set("key1", "value1", 100)
|
||||
assert pool.set("key1", "value2", 0)
|
||||
assert pool.get("key1") == "value2"
|
||||
|
||||
request_flags = RequestFlags(return_value=False)
|
||||
response = pool.meta_get(Key("key1"), flags=request_flags)
|
||||
assert isinstance(response, Success)
|
||||
assert pool.get("key2") is None
|
||||
|
|
|
@ -137,7 +137,7 @@ def test_version(memcached_client: MCClient):
|
|||
Our real version is being returned in the stats command.
|
||||
Also verified manually that php client parses correctly the version string that ends with "DF".
|
||||
"""
|
||||
assert b"1.5.0 DF" == memcached_client.version()
|
||||
assert b"1.6.0 DF" == memcached_client.version()
|
||||
stats = memcached_client.stats()
|
||||
version = stats[b"version"].decode("utf-8")
|
||||
assert version.startswith("v") or version == "dev"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue