aio-libs / aio-libs/aiocache

When using memcached, specifying TTL in set_config results in an error.

オープン
#663 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.4k
フォーク
181
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello.
When using memcached, specifying TTL in set_config results in an error.
Thanks.

aiocache 0.12.0
Python 3.9.7

```
import asyncio
from aiocache import caches

caches.set_config({
'default': {
'cache': "aiocache.SimpleMemoryCache",
'serializer': {
'class': "aiocache.serializers.PickleSerializer"
},
},
'memcached': {
'cache': "aiocache.MemcachedCache",
'serializer': {
'class': "aiocache.serializers.PickleSerializer"
},
'ttl': int(3),
}
})

async def main():
cache = caches.create('memcached')
await cache.set('key', 'value')
ret = await cache.get('key')
print(ret)

asyncio.run(main())
```

```
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiocache/backends/memcached.py", line 44, in _set
return await self.client.set(key, value, exptime=ttl or 0)
File "/usr/local/lib/python3.9/site-packages/aiomcache/client.py", line 42, in wrapper
return await func(self, conn, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/aiomcache/client.py", line 338, in set
return await self._storage_command(conn, b"set", key, value, exptime)
File "/usr/local/lib/python3.9/site-packages/aiomcache/client.py", line 302, in _storage_command
raise ValidationException('exptime not int', exptime)
aiomcache.exceptions.ValidationException: exptime not int: 3.0
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。