Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8437

Implement an atomic `getAndPut` method for `LRUCache`

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-2
    • None
    • None

    Description

      Currently LRUCache just provides basic cache function(i.e. get, put), which can not make sure same entry will not be added multi-times easily and effectively.

      In order to resolve the above problem, ConcurrentLinkedHashMap is refined to support `computeIfAbsent`, which is key function for caches. In addition, LRUCache implements `getAndPut`, which is based on the `computeIfAbsent`.

      Note: the improvement is only available in Groovy 3.0.0+

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: