def add_to_cache(self, dn, app_marker, password):
"""
Add the credentials to the bind cache. They are automatically removed from the cache after ``self.timeout``
seconds using the ``reactor.callLater`` mechanism.
If the credentials are already found in the bind cache, the time until their removal is **not** extended!
:param dn: user distinguished name
:param app_marker: app marker
:param password: user password
"""
item = (dn, app_marker, password)
if item not in self._cache:
current_time = reactor.seconds()
log.info('Adding to bind cache: dn={dn!r}, marker={marker!r}, time={time!r}',
dn=dn, marker=app_marker, time=current_time)
self._cache[item] = current_time
self.callLater(self.timeout, self.remove_from_cache, dn, app_marker, password)
else:
log.info('Already in the bind cache: dn={dn!r}, marker={marker!r}',
dn=dn, marker=app_marker)
bindcache.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录