Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
redis_cache.py
Go to the documentation of this file.
1# SPDX-FileCopyrightText: 2015 Eric Larson
2#
3# SPDX-License-Identifier: Apache-2.0
4
5from __future__ import division
6
7from datetime import datetime
8from pip._vendor.cachecontrol.cache import BaseCache
9
10
12
13 def __init__(self, conn):
14 self.conn = conn
15
16 def get(self, key):
17 return self.conn.get(key)
18
19 def set(self, key, value, expires=None):
20 if not expires:
21 self.conn.set(key, value)
22 elif isinstance(expires, datetime):
23 expires = expires - datetime.utcnow()
24 self.conn.setex(key, int(expires.total_seconds()), value)
25 else:
26 self.conn.setex(key, expires, value)
27
28 def delete(self, key):
29 self.conn.delete(key)
30
31 def clear(self):
32 """Helper for clearing all the keys in a database. Use with
33 caution!"""
34 for key in self.conn.keys():
35 self.conn.delete(key)
36
37 def close(self):
38 """Redis uses connection pooling, no need to close the connection."""
39 pass
for i
clear
Definition prime_search.m:1