You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/01/09 01:45:00 UTC

[jira] [Created] (GROOVY-8437) Implement an atomic `getAndPut` method for `LRUCache`

Daniel Sun created GROOVY-8437:
----------------------------------

             Summary: Implement an atomic `getAndPut` method for `LRUCache`
                 Key: GROOVY-8437
                 URL: https://issues.apache.org/jira/browse/GROOVY-8437
             Project: Groovy
          Issue Type: Improvement
            Reporter: Daniel Sun
            Assignee: Daniel Sun
             Fix For: 3.0.0-alpha-2


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+



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)