Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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,
     )
Esempio 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,
     )
Esempio n. 8
0
 def _callFUT(self, value):
     from anykeystore.utils import coerce_timedelta
     return coerce_timedelta(value)
Esempio 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)
Esempio 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)