コード例 #1
0
ファイル: redis.py プロジェクト: aps-bhat/Neuron-1
 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)
コード例 #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)
コード例 #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)
コード例 #4
0
ファイル: memcached.py プロジェクト: aps-bhat/Neuron-1
    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)
コード例 #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()
コード例 #6
0
ファイル: mongodb.py プロジェクト: niallo/anykeystore
 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,
     )
コード例 #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,
     )
コード例 #8
0
 def _callFUT(self, value):
     from anykeystore.utils import coerce_timedelta
     return coerce_timedelta(value)
コード例 #9
0
ファイル: memory.py プロジェクト: niallo/anykeystore
 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)
コード例 #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)