Giter Club home page Giter Club logo

Comments (10)

primalmotion avatar primalmotion commented on July 23, 2024

the PR #35 would actually also make my life manageable :)

from ccache.

karlseguin avatar karlseguin commented on July 23, 2024

LayeredCache isn't otherwise convenient? (I could imagine a lot of cases where it isn't, just double checking).

If you specifically want a prefix delete, I think I'd like to add a DeletePrefix() method since we could do that a lot more efficiently (don't have to collect all the keys). Thoughts?

from ccache.

primalmotion avatar primalmotion commented on July 23, 2024

Hi,

I've looked at LayeredCache, but I'm sure how it could help me in that particular case, but maybe I'm missing something

Adding DeletePrefix() would be absolutely wonderful

from ccache.

karlseguin avatar karlseguin commented on July 23, 2024

I should have looked more into this before commenting. Only way to avoid collection is to hold a long-lived write lock on the bucket.

What do you think of this implementation:
356e164

I went for a shorter-lived write lock in exchange for more memory (collecting) and cpu (double iteration).

Doesn't support the onDelete callback right now, not sure if it should or not.

from ccache.

primalmotion avatar primalmotion commented on July 23, 2024

woh! that was fast :) For my very use case your implementation seems fine since I don't have millions of items and I prefer sucking a bit more on cpu rather than longer locking.

Let me give it a try on our product

from ccache.

karlseguin avatar karlseguin commented on July 23, 2024

I'll polish it up (documentation + merge) in the next couple days

from ccache.

primalmotion avatar primalmotion commented on July 23, 2024

Would it be possible to make that api DeletePrefixes(key ...string)? If i need to delete multiple prefixes, we would collect all the keys at once

from ccache.

primalmotion avatar primalmotion commented on July 23, 2024

I believe I can close my pr since this is a way more elegant way to achieve what we need. What do you think?

from ccache.

karlseguin avatar karlseguin commented on July 23, 2024

Sounds good :)

from ccache.

primalmotion avatar primalmotion commented on July 23, 2024

I just tried this patch in our app it works perfectly and I removed half of my code. I like that :)

from ccache.

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.