mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
Changelog: https://github.com/pallets-eco/cachelib/blob/main/CHANGES.rst Minor release with improvements to cache backends. Add test.sh to verify SimpleCache and NullCache operations. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
22 lines
529 B
Bash
Executable File
22 lines
529 B
Bash
Executable File
#!/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
|