Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-241

[contribution] PassiveTimeOutMap

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • None
    • 4.0-alpha1, 4.0
    • Map
    • None

    Description

      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.

      Attachments

        1. PassiveTimeOutMap.zip
          503 kB
          Elifarley Callado Coelho

        Issue Links

          Activity

            People

              brentworden Brent Worden
              elifarley@yahoo.com Elifarley Callado Coelho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: