You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Elifarley Callado Coelho (JIRA)" <ji...@apache.org> on 2007/02/16 19:46:05 UTC

[jira] Created: (COLLECTIONS-241) [contribution] PassiveTimeOutMap

[contribution] PassiveTimeOutMap
--------------------------------

                 Key: COLLECTIONS-241
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-241
             Project: Commons Collections
          Issue Type: New Feature
          Components: Map
            Reporter: Elifarley Callado Coelho
            Priority: Minor


This is a Map decorator which passively evicts expired keys once their expiry time has been reached.

When putting a key-value pair in the map, this decorator calls expiryTime(key, value), passing the key and the value as parameters, and uses the returned value as the expiry time for that key.

When getting the value for a key, its expiry time is checked, and if it's greater than the current time, the value is returned. Otherwise, the key is removed from the decorated map, and null is returned.

Doing so, there's no need to have a separate, active thread (hence the name 'passive') to check expiry times - the check is performed on demand.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (COLLECTIONS-241) [contribution] PassiveTimeOutMap

Posted by "Elifarley Callado Coelho (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-241?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elifarley Callado Coelho updated COLLECTIONS-241:
-------------------------------------------------

    Attachment: PassiveTimeOutMap.zip

Source code for PassiveTimeOutMap class, and a ready-to-use usage example (you can run it by using ptom.bat or ptom.sh).

> [contribution] PassiveTimeOutMap
> --------------------------------
>
>                 Key: COLLECTIONS-241
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-241
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Map
>            Reporter: Elifarley Callado Coelho
>            Priority: Minor
>         Attachments: PassiveTimeOutMap.zip
>
>
> This is a Map decorator which passively evicts expired keys once their expiry time has been reached.
> When putting a key-value pair in the map, this decorator calls expiryTime(key, value), passing the key and the value as parameters, and uses the returned value as the expiry time for that key.
> When getting the value for a key, its expiry time is checked, and if it's greater than the current time, the value is returned. Otherwise, the key is removed from the decorated map, and null is returned.
> Doing so, there's no need to have a separate, active thread (hence the name 'passive') to check expiry times - the check is performed on demand.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org