Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to standard tools for in-memory contract object cache #489

Merged

Conversation

cmickeyb
Copy link
Contributor

@cmickeyb cmickeyb commented May 8, 2024

Transition from very simple cache for contract objects to a more standard cache implementation from cachetools. The transition enables both more functionality (explicit client control of when the cache is flushed) and better behavior (automatic flushing of older contract objects).

Several other clean ups of imports and other unused variables.

Transition from very simple cache for contract objects to a more
standard cache implementation from cachetools. The transition enables
both more functionality (explicit client control of when the cache is
flushed) and better behavior (automatic flushing of older contract
objects).

Several other clean ups of imports and other unused variables.

Signed-off-by: Mic Bowman <[email protected]>
Copy link
Contributor

@g2flyer g2flyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, runs in my tests and also learned something about python decorators ..

# expiration from the cache really means that we want the
# contract re-read, so force any expired contracts out of
# the cache before we read it
__get_contract__.cache.expire()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this effectively force cache expiration on each get, so you don't really get the benefits of having a cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. if you read the documentation on cache tools the behavior is more or less what i described. expire only drops those entries that have timed out. all other entries will remain. clear is the operation to drop all cache entries no matter the timing.

@prakashngit prakashngit merged commit da7fddb into hyperledger-labs:main May 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants