appcache.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:privacyidea-ldap-proxy 作者: NetKnights-GmbH 项目源码 文件源码
def add_to_cache(self, dn, marker):
        """
        Add the entry to the app cache. It will be automatically removed after ``timeout`` seconds.
        If an entry for ``dn`` (with any marker) already exists, it will be overwritten.
        Keep in mind that removal will then provoke a "Removal from app
        cache failed: ... mapped to ... " log message!
        If an entry for ``dn`` with the same marker exists, the eviction timeout will *not*
        be extended if it is added again.
        This function respects the ``case_insensitive`` option.
        :param dn: DN
        :param marker: App marker (a string)
        """
        if dn in self._entries:
            log.info('Entry {dn!r} already cached {marker!r}, overwriting ...',
                     dn=dn, marker=self._entries[dn])
        current_time = reactor.seconds()
        log.info('Adding to app cache: dn={dn!r}, marker={marker!r}, time={time!r}',
                 dn=dn, time=current_time, marker=marker)
        self._entries[dn] = (marker, current_time)
        self.callLater(self.timeout, self.remove_from_cache, dn, marker)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号