-
Couldn't load subscription status.
- Fork 41
Implement Cache#invalidateAll #51
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
Conversation
| checkM(Gen.anyInt) { salt => | ||
| for { | ||
| cache <- Cache.make(100, Duration.Infinity, Lookup(hash(salt))) | ||
| _ <- ZIO.foreach(1 to 100)(cache.get) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: maybe capture the count here just to show, after invalidateAll, the count has changed to 0.
for {
cache <- Cache.make(100, Duration.Infinity, Lookup(hash(salt)))
_ <- ZIO.foreach(1 to 100)(cache.get)
size1 <- cache.size
_ <- cache.invalidateAll
size2 <- cache.size
} yield assertTrue(size1 == 100) && assertTrue(size2 == 0)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've got other tests, particularly the one for size below`, to verify that when we add items to the cache they really are included in the cache and reflected in the cache size so we don't need to test that again here.
* Implement Cache#invalidateAll (#51) * implement Cache#invalidateAll * format * Added size to `CacheStats`. (#53) * Added size and capacity to `CacheStats`. * Removed `capacity` from stats. * Update Node.js to v14.18.0 (#55) Co-authored-by: Renovate Bot <[email protected]> * Add `refresh` method to trigger a lookup call. (#52) * First attempt to resolve #42 * Fixed a concurrency issue * Refactoring * Minor refactorings, scalafmt & sbt upgrades * Fixing build * Refactoring: replaced vars with ref * Reformatted build.sbt to fix build. * Fixing build * Fixing build * Updated docs * Fixed formatting and addressed PR comments. * Fixed docs * Added a unit test for `refresh` method. * Improved docs * Minor improvement * Bumped scalafmt * Bumped scalajs * Update Node.js to v14.18.1 (#58) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v2.3.5 (#59) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16 (#61) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.0 (#62) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v2.4.0 (#64) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.1 (#65) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.2 (#68) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.0 (#70) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action (#72) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.1 (#73) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.2 (#74) Co-authored-by: Renovate Bot <[email protected]> * ZIO 2.0.0-RC3 Co-authored-by: Adam Fraser <[email protected]> Co-authored-by: Terry L <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]>
* Implement Cache#invalidateAll (#51) * implement Cache#invalidateAll * format * Added size to `CacheStats`. (#53) * Added size and capacity to `CacheStats`. * Removed `capacity` from stats. * Update Node.js to v14.18.0 (#55) Co-authored-by: Renovate Bot <[email protected]> * Add `refresh` method to trigger a lookup call. (#52) * First attempt to resolve #42 * Fixed a concurrency issue * Refactoring * Minor refactorings, scalafmt & sbt upgrades * Fixing build * Refactoring: replaced vars with ref * Reformatted build.sbt to fix build. * Fixing build * Fixing build * Updated docs * Fixed formatting and addressed PR comments. * Fixed docs * Added a unit test for `refresh` method. * Improved docs * Minor improvement * Bumped scalafmt * Bumped scalajs * Update Node.js to v14.18.1 (#58) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v2.3.5 (#59) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16 (#61) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.0 (#62) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v2.4.0 (#64) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.1 (#65) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.13.2 (#68) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.0 (#70) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action (#72) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.1 (#73) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.14.2 (#74) Co-authored-by: Renovate Bot <[email protected]> * Update hmarr/auto-approve-action action to v2.2.0 (#77) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v3.0.1 (#82) Co-authored-by: Renovate Bot <[email protected]> * Update actions/checkout action to v3.0.2 (#83) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.15.0 (#84) Co-authored-by: Renovate Bot <[email protected]> * Update Node.js to v16.15.1 (#87) Co-authored-by: Renovate Bot <[email protected]> * Cache managed resource (#71) * Add .bsp to .gitignore * Extract KeySet and MapKey out of Cache Because they probably going to be shared with ManagedCache * define interface for a ManagedCache * Copy/Paste: cache implementation and cache test for managedCache * Adapt cache implementation and test for ManagedCache * make ManagedCache.get return Managed[Error, Value] instead of UIO[Managed[Error, Value]] * Make ManagedCache work on 2.11 and Scala 3 * Fix doc after Adam's review * fixup! Fix doc after Adam's review * fixup! Fix doc after Adam's review * fix managed cache invalidate not being lazy (#88) * run finalizer after acquire fails * fix compilation issue * format Co-authored-by: Adam Fraser <[email protected]> Co-authored-by: Terry L <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: LUC DUZAN <[email protected]>
Resolves #43.