Exemplo n.º 1
0
 def store(self, key, value, expires=None):
     key = self._make_key(key)
     c = self._get_conn()
     c.set(key, pickle.dumps(value, protocol=pickle.HIGHEST_PROTOCOL))
     if expires is not None:
         expires = coerce_timedelta(expires)
         c.expire(key, expires.seconds)
Exemplo n.º 2
0
 def store(self, key, value, expires=None):
     key = self._make_key(key)
     c = self._get_conn()
     c.set(key, pickle.dumps(value, protocol=pickle.HIGHEST_PROTOCOL))
     if expires is not None:
         expires = coerce_timedelta(expires)
         c.expire(key, expires.seconds)
Exemplo n.º 3
0
    def store(self, key, value, expires=None):
        key = self._make_key(key)
        log.debug('Servers %s storing %s=%s' % (self.servers, key, value))

        expiration = None
        if expires is not None:
            expiration = coerce_timedelta(expires).seconds
        self._get_conn().set(key, value, expiration or 0)
Exemplo n.º 4
0
    def store(self, key, value, expires=None):
        key = self._make_key(key)
        log.debug('Servers %s storing %s=%s' % (self.servers, key, value))

        expiration = None
        if expires is not None:
            expiration = coerce_timedelta(expires).seconds
        self._get_conn().set(key, value, expiration or 0)
Exemplo n.º 5
0
 def store(self, key, value, expires=None):
     expiration = None
     if expires is not None:
         expiration = datetime.utcnow() + coerce_timedelta(expires)
     c = self._get_conn()
     try:
         self._insert_or_replace(c, key, value, expiration)
     finally:
         c.close()
Exemplo n.º 6
0
 def store(self, key, value, expires=None):
     expiration = None
     if expires is not None:
         expiration = datetime.utcnow() + coerce_timedelta(expires)
     c = self._get_conn()
     c[self.collection].update(
         {"key": key},
         {"$set": {"value": Binary(pickle.dumps(value)), "expires": expiration}},
         upsert=True,
         safe=True,
     )
Exemplo n.º 7
0
 def store(self, key, value, expires=None):
     expiration = None
     if expires is not None:
         expiration = datetime.utcnow() + coerce_timedelta(expires)
     c = self._get_conn()
     api = self.backend_api
     c[self.collection].update(
         {'key': key},
         {
             '$set': {
                 'value': api.binary.Binary(pickle.dumps(value)),
                 'expires': expiration,
             },
         },
         upsert=True,
         safe=True,
     )
Exemplo n.º 8
0
 def _callFUT(self, value):
     from anykeystore.utils import coerce_timedelta
     return coerce_timedelta(value)
Exemplo n.º 9
0
 def store(self, key, value, expires=None):
     expiration = None
     if expires is not None:
         expiration = datetime.utcnow() + coerce_timedelta(expires)
     self._store[key] = (value, expiration)
Exemplo n.º 10
0
 def store(self, key, value, expires=None):
     expiration = None
     if expires is not None:
         expiration = datetime.utcnow() + coerce_timedelta(expires)
     self._store[key] = (value, expiration)