Skip to main content

Redis Tools (retools)

retools is a package of Redis tools. It’s aim is to provide a variety of Redis backed Python tools that are always 100% unit tested, fast, efficient, and utilize the capabilities of Redis.

Current tools in retools:

  • Caching

  • Global Lock

On the horizon for future implementation:

  • A worker/job processing system similar to Celery but based on how Ruby’s Resque system works.

Caching

A high performance caching system that can act as a drop-in replacement for Beaker’s caching. Unlike Beaker’s caching, this utilizes Redis for distributed write-locking dogpile prevention. It also collects hit/miss cache statistics along with recording what regions are used by which functions and arguments.

Example:

from retools.cache import CacheRegion, cache_region, invalidate_function

CacheRegion.add_region('short_term', expires=3600)

@cache_region('short_term')
def slow_function(*search_terms):
    # Do a bunch of work
    return results

my_results = slow_function('bunny')

# Invalidate the cache for 'bunny'
invalidate_function(slow_function, [], 'bunny')

Differences from Beaker

Unlike Beaker’s caching system, this is built strictly for Redis. As such, it adds several features that Beaker doesn’t possess:

  • A distributed write-lock so that only one writer updates the cache at a time across a cluster.

  • Hit/Miss cache statistics to give you insight into what caches are less effectively utilized (and may need either higher expiration times, or just not very worthwhile to cache).

  • Very small, compact code-base with 100% unit test coverage.

Locking

A Redis based lock implemented as a Python context manager, based on Chris Lamb’s example.

Example:

from retools.lock import Lock

with Lock('a_key', expires=60, timeout=10):
    # do something that should only be done one at a time

License

retools is offered under the MIT license.

Authors

retools is made available by Ben Bangert.

retools

Next release

  • Job/Worker system based on Ruby’s Resque model.

0.1 (07/08/2011)

Features

  • Caching in a similar style to Beaker, with hit/miss statistics, backed by a Redis global write-lock with old values served to prevent the dogpile effect

  • Redis global lock

Metadata

Release files for retools 0.1

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

Source distribution (sdist)

Source distribution for retools 0.1
File Size Uploaded Provenance Actions
retools-0.1.tar.gz 12.5 kB Without provenance Details for retools-0.1.tar.gz

Release files / retools-0.1.tar.gz

Download URL retools-0.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f24f2dc71aaff6e51e8935754f27c288d9e05147cbde9a7a12612b069b04bb54
BLAKE2b-256 checksum
How to use checksums
bb4425ad8b3349541f7f66280522a86d6a707d81b1dc6ddd5736ff8828c9e216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for retools 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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