Coder Social home page Coder Social logo

Comments (4)

mmstick avatar mmstick commented on June 30, 2024 1

At least you could provide an additional set of get methods that takes a closure, such as get_with, so the option is available for larger types.

from concache.

jonhoo avatar jonhoo commented on June 30, 2024

Ideally we wouldn't require Copy or Clone, but sadly they're required to provide the get interface we currently have (i.e., fn get(&self, key) -> V). Because of the nature of the concurrent map, we can't easily provide get(..) -> &V like traditional maps. The likely path forward here is to have get take a closure that is given &V, but that requires some more work on our part.

The reason we currently require Copy over Clone is to discourage users from using values that are expensive to clone in the map (since their get would become pretty slow). That might not be a good way to do so, but I think I'd rather see a move to get with a closure rather than moving to Clone. @andrewtshen @saligrama what do you think?

from concache.

jonhoo avatar jonhoo commented on June 30, 2024

I completely agree! The codebase belongs to @andrewtshen and @saligrama though — I'm just mentoring them — so I'll let them make the final call.

from concache.

andrewtshen avatar andrewtshen commented on June 30, 2024

Yea, that definitely seems like a good addition, I'll try to add that if I have time

from concache.

Related Issues (6)

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.