Giter Site home page Giter Site logo

Comments (5)

alastairtree avatar alastairtree commented on May 30, 2024

Hi. Thanks for the suggestion. Wondering why you would want that/what problem it solves as i think that change would make the api less productive? The difference between LazyCache and ObjectCache is that in GetOrAddAsync we accept a delegate, not the actual value, so if we are adding to the cache the value has not been constructed yet. That means if we returned null you would not have a reference to it unless you kept hold of one in your delegate which feels messy to me. Or have I miss understood?

from lazycache.

alastairtree avatar alastairtree commented on May 30, 2024

No reply for a while, closing.

from lazycache.

PureKrome avatar PureKrome commented on May 30, 2024

Hi @alastairtree - it's been a while since I used this. So I can't remember the exact use case.

It was along the lines of something like:

  • get item from cache.
  • if item doesn't exist, then add to cache.
  • now record WHAT happened

the problem is the last step. I don't know if the item was added or just retrieved.

I think that's why I created this issue.

from lazycache.

alastairtree avatar alastairtree commented on May 30, 2024

In that case the "record what happened" code can be done inside the callback as that only gets executed when the item is actually generated for the cache?

from lazycache.

PureKrome avatar PureKrome commented on May 30, 2024

I understand what you're suggesting and think that has merit - I just wondered if I had problems with that when I last tried it?

Sample code or some updated docs with an example?

from lazycache.

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.