예제 #1
0
파일: cache.py 프로젝트: bluele/Lamia
 def _fetch_cache_memory(self, key):
     '''
     @summary:
         指定したキーでメモリ上のキャッシュからデータを取得します
     '''
     data = self.cache[key]
     if is_expired(data.expiration_date):
         del self.cache[key]
         raise ExpiredError("ExpiredError")
     return data.val
예제 #2
0
파일: cache.py 프로젝트: bluele/Lamia
 def _delete_expired_key(self, key):
     '''
     @summary: 
         指定されたパスのファイルが期限切れの場合、削除します
     '''
     path = build_path(self.cache_dir, key)
     data = load(path)
     if is_expired(data.expiration_date):
         # 古いキャッシュの際は削除する
         self._delete_file(path)
예제 #3
0
파일: cache.py 프로젝트: bluele/Lamia
 def _fetch_cache_file(self, key):
     '''
     @summary: 
         指定したキーでファイル上からデータを取得します
     '''
     try:
         path = build_path(self.cache_dir, key)
         data = load(path)
         if is_expired(data.expiration_date):
             raise ExpiredError("ExpiredError")
     except IOError:
         # if not exists file
         raise KeyError(key)
     except OSError:
         # Not Found key-cachefile
         raise KeyError(key)
     except ValueError,err:
         raise ValueError("Cache File '%s' style is wrong." % path)