Git Product home page Git Product logo

Comments (10)

digitalbuddha avatar digitalbuddha commented on May 18, 2024 1

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.

pavlospt avatar pavlospt commented on May 18, 2024

@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.

PaulWoitaschek avatar PaulWoitaschek commented on May 18, 2024

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.

digitalbuddha avatar digitalbuddha commented on May 18, 2024

For now backwards compatibility. I'll Deprecated and consider removing in v2.

from store.

PaulWoitaschek avatar PaulWoitaschek commented on May 18, 2024

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.

digitalbuddha avatar digitalbuddha commented on May 18, 2024

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.

PaulWoitaschek avatar PaulWoitaschek commented on May 18, 2024

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.

digitalbuddha avatar digitalbuddha commented on May 18, 2024

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.

digitalbuddha avatar digitalbuddha commented on May 18, 2024

@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.

pavlospt avatar pavlospt commented on May 18, 2024

@digitalbuddha Is there a chance to have memory and disk cache side-by-side?

from store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.