Releases: agkloop/go_memoize
Releases · agkloop/go_memoize
V1.1.2
v1.1.1
V1.1.0
Release Notes
New Features
-
MemoizeCtx Functions: Introduced a new set of
MemoizeCtxfunctions to support memoization of functions that accept acontext.Contextparameter. These functions allow for efficient caching and retrieval of results based on input parameters and context, improving performance for expensive or frequently called functions.MemoizeCtx: Memoizes a function with context and no parameters.MemoizeCtx1: Memoizes a function with context and 1 parameter.- ... until
MemoizeCtx7
Enhancements
- Hide entries attr of the cache class.
- Concurrency Support: The
MemoizeCtxfunctions are designed to be thread-safe and concurrent-safe, ensuring reliable performance in multi-threaded environments.
Examples
Basic Memoization with Context
computeCtxFn := func(ctx context.Context) int {
// Expensive computation
return 42
}
memoizedCtxFn := MemoizeCtx(computeCtxFn, 10*time.Second)
result := memoizedCtxFn(context.Background())Memoization with Context and Parameters
computeCtxFn := func(ctx context.Context, a int) int {
// Expensive computation
return a * 2
}
memoizedCtxFn := MemoizeCtx1(computeCtxFn, 10*time.Second)
result := memoizedCtxFn(context.Background(), 5)Bug Fixes
- N/A
Known Issues
- N/A
Documentation
- Updated the
README.mdto include usage examples and descriptions for the newMemoizeCtxfunctions.