mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

A way to reset MemoizingSupplier/ExpiringMemoizingSupplier for tests #1834

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Before executing test methods I would like to reset state of the involved 
components, however currently there is no way to perform this on memoizing 
suppliers.

These 2 implementations should implement an interface, which can be called 
either directly if declared as public, or via some static function in Suppliers 
if declared as private.

Original issue reported on code.google.com by alex.pan...@gmail.com on 19 Aug 2014 at 12:30

GoogleCodeExporter commented 9 years ago
This is a feature that definitely should be covered by the proposed 
single-element-cache API. In the meantime, we recommend:

private enum Key { INSTANCE }
...
LoadingCache<Key, MyValue> cache = ...;
...
cache.invalidate(Key.INSTANCE);

Original comment by cpov...@google.com on 19 Aug 2014 at 1:41

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07