No project description provided
Project description
diskcache-fernet
how to install
$ pip install diskcache-fernet
how to use
from __future__ import annotations
from pathlib import Path
from tempfile import TemporaryDirectory
from diskcache import Cache
from diskcache_fernet import FernetDisk
def main(temp: Path) -> None:
origin = Cache(temp)
fernet = Cache(temp, disk=FernetDisk)
# or add fernet key
# fernet = Cache(temp, disk=FernetDisk, disk_fernet=b"some fernet key")
fernet["key"] = "value"
from_fernet = fernet["key"]
from_origin = origin["key"]
assert from_fernet != from_origin
assert from_fernet == "value"
print(from_origin)
# like:
# gAAAAABlGtPWAPEcYLqu6waiUd551H4jfAvQlulWnfwyWTVtjZyF6AkUCVFQKPpIRz9vu29y1FoduIYoK-mOz5CJt0Kx-pv2zQ==
if __name__ == "__main__":
with TemporaryDirectory() as temp:
main(Path(temp))
License
Apache-2.0, see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
diskcache_fernet-0.1.3.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for diskcache_fernet-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef421938abfe06fd3736696e7a4b8a8948bef18b8abf1808f44c95658fc4c623 |
|
MD5 | 09409669e415d6e01ee6a0607cc0e7e7 |
|
BLAKE2b-256 | c2b1404e7eef94acf390c29fbd4766e4362107238af28c80a33b3dd885616cc9 |