MongoDB设置缓存时间
def __init__(self,client=None,expires=timedelta(days=30)):
self.client = MongoClient('localhost', 27017)
self.db=self.client.cache
self.db.webpage.create_index('timestamp',expireAfterSeconds=expires.total_seconds())
压缩
return record['result']
return pickle.loads(zlib.decompress(record['result']))