Comments (10)
You can have both but I don't see a use case where you want to clear your memory cache but not your disk. If that is your use case you can always not implement clearable in your persister
from store.
@digitalbuddha it should also provide an interface for whole disk cache clear I suppose. But that I guess would be exposed internally from the FileSystem ?
from store.
Why would one want to clear one without the other? (cache & persistence)
Why shouldn't it be mandatory for persisters to be able to clear their data?
from store.
For now backwards compatibility. I'll Deprecated and consider removing in v2.
from store.
What about defining a common interface like Clearable
that both the cache and the persister can implement? Then upon calling .clear
throwing a NotSupportedException
if the persister is not an instance of Clearable
?
from store.
Not following, mind explaining what you mean? Also the memory cache is currently a guava cache which we don't have control over interface. I guess it can be wrapped but yeah mind explaining what you mean?
from store.
If I understand you correctly, you want to give the option to add a DiskClearer
to the store that you supply through the builder.
This class responsibility is to clear data from the Persister
.
So my suggestion is to instead of having a separate DiskClearer
to have an interface that Persisters
can implement to indicate that they know how to clear data.
Then if someone would call clear
without his Persister
implmenting Clearable
an NotSupportedException("The supplied persister must implement Clearable")
Or do I get you completely wrong?
from store.
Sure that makes sense. I was trying to handle the lambda case in the way that DiskRead
& DiskWrite
exist for when a Store is instantiated. So maybe instead it should just be an additional override to .persister(reader, writer, clearer)
while also allowing the interface to be implemented by someone implementing the current Persister
interface. Thanks for feedback!
from store.
@PaulWoitaschek I'm starting to side with you. If there is a memory and disk cache why would someone only want to clear the memory one? I'll instead rename clearMemory
to clear
and then clear disk when the disk implements clearable
thank you for feedback
from store.
@digitalbuddha Is there a chance to have memory and disk cache side-by-side?
from store.
Related Issues (20)
- Store 4 design document HOT 2
- Observe changes in disk without invalidating cache HOT 2
- NetworkOnMainThread thrown when performing a clear from the MainThread HOT 1
- Question: Convert List<T> From API to BufferedSource
- Question: Shouldn't Persister.write return single which will write to cache only after subscribe? HOT 2
- Sample crashes on launch
- Get data always hits the network without persister HOT 5
- Clear FileSystemPersister HOT 1
- Support for partial fetches (for paginated APIs) HOT 1
- Clearable HOT 2
- Feature Request : support for multiple get/fetch HOT 1
- RecordPersister's 'Expiration' is not working HOT 8
- Misleading docs and behavior of Store.clear() HOT 6
- How to determine if a key is in memory cache? HOT 3
- fetchWithResult returns NETWORK even on network errors HOT 2
- Issue with gradle plugin 3.4.0 HOT 11
- Provide a method for getting data from memory cache
- Having trouble fetching data using android nytimes store library HOT 1
- Request is made multiple times
- This library seems to be deprecated. Other alternatives? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store.