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.4.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for diskcache_fernet-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90677248ed277803f4351de475e8432276e1775b9ca91f8995f09bfc8f149dd3 |
|
MD5 | 3c8bdd73717c467a910c4d097481ef78 |
|
BLAKE2b-256 | 6fec0d1c254f26e285874829c2d71875349cab653d37b3d5b38dcca2aaff83d6 |