Uploaded image for project: 'BrainzUtils'
  1. BrainzUtils
  2. BU-10

Expiring keys doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • Python
    • None

      1. When creating a cache item with an expiry time, the key is hashed twice, which means that we never set the expiry of the key: https://github.com/metabrainz/brainzutils-python/blob/8420319c488bf3fba53483f7e4f0c062e0581fb0/brainzutils/cache.py#L167-L168

      2. Documentation for set says that the expire time can be provided in seconds, or an epoch time, or 0. Documentation for set_many (which is called by set) says that expire time must be in milliseconds:
      https://github.com/metabrainz/brainzutils-python/blob/8420319c488bf3fba53483f7e4f0c062e0581fb0/brainzutils/cache.py#L167-L168
      https://github.com/metabrainz/brainzutils-python/blob/8420319c488bf3fba53483f7e4f0c062e0581fb0/brainzutils/cache.py#L157

      I've checked AB, LB, CB, MeB, and all calls to cache.set that have a time expect this to be set with seconds, so I propose standardising the API to use seconds, and remove the absolute time. It looks like this was a holdback from Memcache (from the memcache docs: "Any time higher than 30 days is interpreted as a unix timestamp date.")

            alastairp Alastair Porter
            alastairp Alastair Porter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package