blob: 4d6a0de95e21797a16c6c1f67c41ebea7c5f018a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
[ "$1" = python3-cachelib ] || exit 0
python3 - << 'EOF'
from cachelib import SimpleCache, NullCache
cache = SimpleCache()
cache.set("key", "value")
assert cache.get("key") == "value", "SimpleCache set/get failed"
assert cache.get("missing") is None
cache.delete("key")
assert cache.get("key") is None, "delete failed"
cache.set("a", 1)
cache.set("b", 2)
cache.clear()
assert cache.get("a") is None, "clear failed"
null = NullCache()
null.set("k", "v")
assert null.get("k") is None, "NullCache should not store"
EOF
|