Skip to main content

rcache.py

pipeline status

What is it

rcache.py is a cache and works on redis so it is suitable for multi threaded and multi process applications. It has been inspired and based on cache.py library https://github.com/bwasti/cache.py

Usage

To use the file, import rcache and annotate functions with @rcache.rcache().

import rcache

@rcache.rcache()
def expensive_func(arg, kwarg=None):
  # Expensive stuff here
  return arg

The @rcache.rcache() function can take multiple arguments.

  • @rcache.rcache(timeout=20) - Only caches the function for 20 seconds.
  • @rcache.rcache(url="http://other_redis:6379") - Saves cache to specified Redis url (defaults to http://localhost:6379)
  • @rcache.rcache(key=rcache.ARGS[KWARGS,NONE]) - Check against args, kwargs or neither of them when doing a cache lookup.

How it works

rcache.py queries redis and checks against the name, arguments and hash of a function's source to decide if the function has been run before. If it has it returns the cached result immediately.

Metadata

Release files for rcache 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rcache 1.0.0
File Size Uploaded
rcache-1.0.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rcache 1.0.0
File Interpreter ABI Platform
rcache-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / rcache-1.0.0.tar.gz

Download URL rcache-1.0.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
35ec2195ff7df7925a345e8a2d4550d42a92129ae93635960ee3616a77e40c7c
BLAKE2b-256 checksum
How to use checksums
508f23449080ccbd420093a7e08540720b2afdd425b09c85a75af8d93e49554d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.2 Linux/4.14.48-coreos-r2

Release files / rcache-1.0.0-py3-none-any.whl

Download URL rcache-1.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0e7fad9d695c12320d5c07b9487601c3496f9401abffa06591ec34815e13265
BLAKE2b-256 checksum
How to use checksums
7cb57567ffc16f819716210a4f6327d0a505f00e312506d4fbe99c164705a302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.2 Linux/4.14.48-coreos-r2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page