Skip to main content

A simple and easy-to-use file caching tool

Project description

python-file-cache

一个简单易用的Python的文件缓存工具

A simple and easy-to-use file caching tool

安装 Install

pip install filecaching

如何使用 How to use

# 引入 Import
from filecaching import FileCache
# 实例化 Instantiate
fc = FileCache()
#(可以使用FileCache(cache_path)指定缓存目录路径)
# (You can use FileCache(cache_path) specify the cache directory path)
fc = FileCache(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cache'))
# 设置缓存 Set cache
fc.cache(key, value)
# 设置具有有效期的缓存 Set cache with an expiration date(单位是秒)
fc.cache(key, value, expiration_seconds)
# 读取缓存 Get cache
fc.cache(key)
# 删除 Remove cache
fc.rm(key)

一些实例 Some examples

from filecaching import FileCache
fc = FileCache()
# 设置缓存 Set cache
fc.cache('a', {'v': 'abc'})
# 设置具有有效期的缓存 Set cache with an expiration date (30s)
fc.cache('b', [1,2,3], 30)
# 读取缓存 Get cache
print(fc.cache('a'))
print(fc.cache('b'))
# 删除 Remove cache
fc.rm('a')

LICENSE

Apache-2.0 License

Source code

https://github.com/jeeaay/python-file-cache

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

filecaching-0.0.4.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filecaching-0.0.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file filecaching-0.0.4.tar.gz.

File metadata

  • Download URL: filecaching-0.0.4.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for filecaching-0.0.4.tar.gz
Algorithm Hash digest
SHA256 81b938f8abea90700152472a1ef4830744c307df649332c91dbe4703458ea179
MD5 3dfb353b7bdf3fa5506a6c6ac2ab7646
BLAKE2b-256 5c7385411120c1bdeb472cc24e54b7e02cc41730e7bc4bcfc051c52864891bd9

See more details on using hashes here.

File details

Details for the file filecaching-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: filecaching-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for filecaching-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 462a2d67436f3bf268742375120b0655b4d19e972bc4d1e52327b9f1d83538cc
MD5 7ee990c4d95983c229856eaef65e8add
BLAKE2b-256 386062960a55e5c60c4fe8cf018ca5314c16eb7a3f3d07797ed453d6f61c3156

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page