Skip to main content

A simple package for caching python objects.

Project description

Cacheasy

This is a simple utility Python package for caching Python objects. Makes use of the pickle standard library and simply stores files in a folder called cache. If you want to use another location, you can specify cache_folderpath in a .env file.

Writing to cache

import cacheasy
x = 5
cacheasy.write_to_cache(x, 'my_cool_x')

Reading from cache

import cacheasy
x = cacheasy.read_from_cache('my_cool_x')

Common usage

A common work flow is to check if a file is in the cache, if it is not to create it and write to cache, if the file is in cache you read it:

import cacheasy
x_cache_filepath = 'my_cool_x'
if cacheasy.file_in_cache(x_cache_filepath):
    x = cacheasy.read_from_cache(x_cache_filepath)
else:
    x = 5
    cacheasy.write_to_cache(x_cache_filepath)

Removing from cache

To delete a file from the cache:

import cacheasy
cacheasy.remove_from_cache('my_cool_x')

To easily delete all cache (including the folder):

import cacheasy
cacheasy.clear_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

cacheasy-0.0.6.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

cacheasy-0.0.6-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file cacheasy-0.0.6.tar.gz.

File metadata

  • Download URL: cacheasy-0.0.6.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for cacheasy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5cce5eb5b908a2f2da4c2f436b8cba35516d5cdf8eb0b870ad71cd44a0008afb
MD5 7a78a68ad407a682ade3767edc08cba2
BLAKE2b-256 86f8c03391d50ab6b541ed5393a8e4a9511cf2e42f29ca455de35d79e6198567

See more details on using hashes here.

File details

Details for the file cacheasy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: cacheasy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for cacheasy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4cfd9ec7ac1ff52f246e2ae058649d4ba3645d67852f79d249814cf51854d98e
MD5 f28d0c93f279ed82489845a5be92e63c
BLAKE2b-256 a5bca6dd6b926e824818f0e2d2cc1eeafc2472130b904e514ab9036d53019491

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