Coder Social home page Coder Social logo

kotlin-cache2k-spring's People

Stargazers

 avatar

Watchers

 avatar

kotlin-cache2k-spring's Issues

Cache configuration with expirypolicy

The cache configuration looks strange:

        val expiryPolicy = { key:Any, value:Any?, loadTime:Long, oldEntry:Any? ->
            if (value == null) { ExpiryTimeValues.NO_CACHE } else { ExpiryTimeValues.ETERNAL }
        }
       ....
           expireAfterWrite(30, TimeUnit.SECONDS).permitNullValues(true).
           expiryPolicy(expiryPolicy)

Is there really any troubles with null values? Probably you can remove permitNullValues(true) and the expiry policy.

One person per cache entry?

The example right now, reads all persons in one go and just all persons in one entry.
This kind of scenario is quite rare in real world. In case you have millions of persons, you would use a cache, so the persons you are currently working with are available faster.

So I would put one person per cache entry.

Suggestions:

  • Establish a person ID
  • have a cachable method to get a person: Person get(String id)
  • hava a cachable (the search cache) method to find persons: List<String> findPersons(String searchString)

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.