Skip to content

Commit

Permalink
expire group membership cache after 600 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
oetiker committed Oct 15, 2015
1 parent bcd042e commit 7a9a6ee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyntlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,14 @@ def clean(self):
def has(self, group, user):
if not self._cache.has_key(group):
return False
return self._cache[group].has_key(user)
haskey = self._cache[group].has_key(user)
if haskey:
if self._cache[group][user] + 600 < int(time.time()):
self._mutex.acquire()
del self._cache[group][user]
self._mutex.release()
return False
return haskey

cache = CacheConnections()
cacheGroups = CacheGroups()
Expand Down

0 comments on commit 7a9a6ee

Please sign in to comment.