For memoization constraints, the strongest matches are hashicorp/golang-lru (This thread-safe Go library provides an in-memory cache featuring), coocood/freecache (Freecache provides concurrent in-memory caching with a fixed size) and isaacs/node-lru-cache (This JavaScript caching utility provides memory limits, time-to-live expiration). dgraph-io/ristretto and pmylund/go-cache round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Hand-picked memoization libraries for managing function cache limits, compared by features and GitHub stars to find the best fit.
This is a thread-safe in-memory cache library for Go that automatically evicts the least recently used items when capacity is reached. It provides a fixed-size memory cache designed to maintain a constant memory footprint by removing the oldest entries as new data arrives. The system includes an eviction manager that executes custom callbacks when entries are purged to facilitate resource cleanup. It also supports time-based expiration, allowing for the automatic removal of items after a specified time-to-live duration. The library covers general caching capabilities including cache inspecti
This thread-safe Go library provides an in-memory cache featuring fixed capacity limits and time-to-live expiration policies, directly matching your need for a constrained memoization utility.
freecache is a high-performance, concurrent in-memory key-value store library for Go applications. It functions as a fixed-size cache that manages large volumes of data while eliminating garbage collection overhead through the use of preallocated memory and off-heap storage. The system maintains a predictable memory footprint by utilizing fixed memory allocation and circular buffer management, where new entries automatically overwrite the oldest data upon reaching capacity. It further reduces contention between simultaneous readers and writers through lock-striped concurrent access. The libr
Freecache provides concurrent in-memory caching with a fixed size limit and eviction policies, though it is designed as a key-value store rather than a dedicated function memoization utility.
node-lru-cache is a key-value store for Node.js that implements a memory-limited cache. It prevents memory exhaustion by capping the total number of items or total byte size, automatically evicting the least-recently-used items to maintain these limits. The project provides specialized caching patterns, including time-to-live durations to ensure data freshness and a stale-while-revalidate mechanism that serves expired content while asynchronously fetching updates in the background. It also includes diagnostic tools for monitoring cache hits, misses, and eviction metrics through operational st
This JavaScript caching utility provides memory limits, time-to-live expiration, and eviction policies, though it functions as a general LRU cache store rather than a dedicated function memoization wrapper.
Ristretto is a high-performance in-memory cache and concurrent key-value store for Go applications. It provides a thread-safe memory store that manages strict memory bounds and employs probabilistic set filters to reduce lookup overhead. The system is distinguished by an admission-policy cache that utilizes frequency sketches and cost-based eviction to maximize hit ratios. It minimizes contention and improves throughput through the use of striped ring buffers and concurrent map sharding. The project covers a broad range of data management capabilities, including time-based expiration, item f
Ristretto is an in-memory caching library for Go that provides time-to-live expiration, strict memory bounds, and thread safety, though it lacks built-in weak references and async function support.
go-cache is a thread-safe, in-memory key-value store for single-machine applications. It provides a local caching mechanism that stores objects in RAM to reduce redundant data retrieval and avoid the overhead of network protocols or serialization. The system features a persistent cache store that saves the in-memory state to a local file, allowing data recovery across application restarts. The project manages concurrent data access across multiple routines and implements time-to-live expiration for cached entries. A background process periodically scans the store to delete expired items and
It provides an in-memory caching utility with thread safety and time-to-live expiration, though it lacks some advanced features like weak references and explicit size eviction limits.
go-cache is a thread-safe, in-memory cache library for Go that stores arbitrary objects with per-item expiration timestamps. It provides a concurrent key-value store where multiple goroutines can safely read and write shared cached data without external synchronization, using a mutex-guarded map for access control. The library distinguishes itself through its expiration management and optional disk persistence. Each cached item carries its own time-to-live, and a background goroutine periodically purges expired entries. The cache can serialize its entire contents to disk using Go's gob encodi
This thread-safe Go cache library provides in-memory storage with time-to-live expiration and concurrent access support, though it lacks features like size limits, weak references, and explicit async function wrappers.
Caffeine is a high-performance caching library for the Java virtual machine designed to manage object lifecycles within the application heap. It functions as a thread-safe, memory-resident data store that reduces latency by keeping frequently accessed objects available for immediate retrieval. The library distinguishes itself through a sophisticated eviction strategy that balances recency and frequency to determine which entries to retain. It utilizes a frequency-based admission policy to evaluate the historical access patterns of new data, ensuring that the cache remains populated with the m
Caffeine is a high-performance Java caching library that provides thread safety, size limits, time-to-live expiration, custom keys, weak references, and async support, exactly matching your need for a constrained memoization and caching utility.
Guava is a Java standard library extension and utility toolkit that provides optimized data structures, concurrency tools, and core extensions. It serves as a comprehensive set of helpers for Java development, focusing on reducing repetitive boilerplate logic. The project is distinguished by its specialized implementations of immutable collections, which ensure thread safety and data consistency by preventing accidental modification. It also includes a dedicated graph data structure library for modeling and traversing networks of interconnected nodes and edges, alongside advanced collection t
Guava provides robust in-memory caching utilities with features like size limits, time-based expiration, and concurrency support, making it a strong fit despite being a broader Java utility toolkit rather than a dedicated memoization library.
This project is a disk-backed key-value store and persistent data structure library for Python. It provides a mechanism for persisting mappings, sets, and queues to the local filesystem to bypass memory limitations and cache expensive function results across threads and processes. The system serves as a cross-process synchronization tool, offering distributed locks, semaphores, and barriers to coordinate shared resource access. It implements advanced caching strategies such as probabilistic stampede prevention, sharded data partitioning to increase throughput, and least-recently-used eviction
This disk-backed persistent cache library provides memoization and caching utilities with eviction policies and thread safety, though it focuses on disk storage rather than in-memory constraints.
Reselect is a memoized selector framework and state selector library designed to optimize performance in Redux applications. It provides a system for computing derived data from a state store and caching the results to prevent unnecessary user interface re-renders. The library functions as a state transformation pipeline, allowing multiple selectors to be composed into chains. This enables the creation of complex data transformation pipelines where the output of one memoized selector serves as the input for another. The framework focuses on input-based memoization and referential equality ch
Reselect is a state selector and memoized computation library designed for frontend applications, making it a well-suited utility for targeted memoization tasks even though it lacks comprehensive expiration and eviction policies.
Memoize-one is a JavaScript function memoization library that stores function return values and serves them instantly on repeat calls with identical arguments to avoid redundant calculations. It retains only the single most recent argument set and return value, maintaining a constant and bounded memory footprint. The library features a shallow argument comparison engine and includes the runtime execution context alongside input arguments during comparison to ensure state and binding changes trigger fresh computations. Users can inject custom equality functions to override the default argumen
Memoize-one is a JavaScript memoization library with a bounded single-result cache and custom equality support, though it lacks time-to-live expiration and asynchronous function handling.
Fast-memoize.js is a JavaScript memoization library that caches function return values for identical arguments to speed up expensive execution in JavaScript applications. It operates as a caching utility that stores and retrieves function outputs by serializing input parameters into unique keys. The library optimizes execution through arity-based function specialisation, generating tailored internal call paths based on the expected number of arguments. It features deterministic argument serialization to convert complex and variadic input parameters into unique string keys for reliable cache l
Fast-memoize.js is a JavaScript memoization library that provides function result caching with custom serializer injections, though it lacks built-in time-to-live expiration and size limit policies out of the box.
Reselect is a state management optimization tool and memoization utility designed to minimize redundant calculations and UI re-renders. It functions as a library for creating memoized selectors that derive specific data from a state store. The library implements input-based memoization and recursive selector composition to create a hierarchy of derived data dependencies. It ensures reference-stable result caching and provides custom equality checking to determine when a cache should be invalidated. The project covers capabilities for derived data computation, frontend performance optimizatio
Reselect provides memoized selectors for derived state with custom equality checking and caching, though it is tailored for Redux rather than general-purpose caching with explicit eviction policies or TTL expiration.
A method caching macro for elixir using CAS on ETS.
This Elixir library provides method caching using ETS table operations, making it a solid utility for memoization despite lacking some of the advanced asynchronous and weak reference features.
Memoize promise-returning & async functions
This library provides memoization specifically for promise-returning and asynchronous functions, fulfilling the core async requirement though it lacks built-in size limits and complex eviction policies.
Memoize promise-returning functions. Includes cache expire and prefetch.
This JavaScript library memoizes promise-returning functions with expiration support, making it a fitting caching utility even though it lacks some advanced policies like size limits or weak references.
Extensible memoizing collections and decorators
This Python library provides extensible memoizing collections and decorators supporting size limits, expiration, and custom key generation, fitting the caching utility category well though lacking asynchronous function support.
A Swift macro for easy function memoization.
This repository provides a Swift macro for function memoization, fitting the category as a language-specific utility even though it has a narrower feature set compared to a comprehensive caching library.
Rust cache structures and easy function memoization
This Rust library provides cache structures and function memoization with explicit cache size limits and time-to-live expiration, fitting the requested caching utility category well despite lacking some advanced features like weak references or asynchronous support.
Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input
This TypeScript utility memoizes function results to speed up consecutive calls, offering expiration and custom key generation, though it lacks built-in support for asynchronous functions and explicit size limits.
| Repository | Stars | Language | License | Last push |
|---|---|---|---|---|
| hashicorp/golang-lru | 5.1K | Go | MPL-2.0 | |
| coocood/freecache | 5.4K | Go | MIT | |
| isaacs/node-lru-cache | 5.9K | JavaScript | BlueOak-1.0.0 | |
| dgraph-io/ristretto | 6.9K | Go | Apache-2.0 | |
| pmylund/go-cache | 8.8K | Go | MIT | |
| patrickmn/go-cache | 8.8K | Go | MIT | |
| ben-manes/caffeine | 17.7K | Java | Apache-2.0 | |
| google/guava | 51.5K | Java | Apache-2.0 | |
| grantjenks/python-diskcache | 2.8K | Python | other | |
| reactjs/reselect | 19K | TypeScript | MIT |