Skip to content

Releases: agkloop/go_memoize

v1.1.1

14 Apr 10:02
e81d294

Choose a tag to compare

renaming (#3)

V1.1.0

14 Mar 13:09

Choose a tag to compare

Release Notes

New Features

  • MemoizeCtx Functions: Introduced a new set of MemoizeCtx functions to support memoization of functions that accept a context.Context parameter. 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 MemoizeCtx functions 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.md to include usage examples and descriptions for the new MemoizeCtx functions.

v1.0.12

28 Feb 16:18

Choose a tag to compare

docs

v1.0.11

27 Feb 14:16

Choose a tag to compare

readme