2024-10-28 00:04:35 +03:00
|
|
|
import os
|
|
|
|
from pymemcache.client import base
|
|
|
|
|
2024-12-14 08:52:01 +03:00
|
|
|
|
|
|
|
client = base.Client((os.getenv('MEMCACHED_HOST', 'localhost'), os.getenv('MEMCACHED_PORT', 11211)))
|
2024-10-28 00:04:35 +03:00
|
|
|
|
|
|
|
def add_rec(key, value):
|
|
|
|
client.set(str(key), value)
|
|
|
|
|
|
|
|
def get_rec(key):
|
|
|
|
value = client.get(str(key))
|
|
|
|
return (int(value))
|