Skip to main content

dictionary style caches.

Project description

Faste is a cache library to allow many different cache algorithms in Python, with the functionality of a regular dict. Anything you can do to a dict, you can do to these caches.

$ pip install faste

All The Caches(tm)

Every cache has the signature CacheNameHere(max_items)

max_items is the max length of the cache before items start getting evicted.

import faste

# Random Replacement
# When cache is full, random items are removed to make space for new ones
RR = faste.RRCache(max_items)

# First In First Out
# When cache is full, cache evicts the last key that was set
FIFO = faste.FIFOCache(max_items)

# Least Recently Used
# When cache is full, least recently accessed item is evicted
LRU = faste.LRUCache(max_items)

# Most Recently Used
# When cache is full, most recently accessed item is evicted
# Useful for caches where old data is more commonly accessed
MRU = faste.MRUCache(max_items)

# Least Frequently Used
# When cache is full, least frequently accessed item is evicted
LFU = faste.LFUCache(max_items)

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

faste-0.1.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Supported by

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