appcache.py 文件源码

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

项目:privacyidea-ldap-proxy 作者: NetKnights-GmbH 项目源码 文件源码
def get_cached_marker(self, dn):
        """
        Retrieve the cached marker for the distinguished name ``dn``. This actually checks that the stored entry
        is still valid. If ``dn`` is not found in the cache, ``None`` is returned and a message is written to the log.
        This function respects the ``case_insensitive`` option.
        :param dn: DN
        :return: string or None
        """
        if dn in self._entries:
            marker, timestamp = self._entries[dn]
            current_time = reactor.seconds()
            if current_time - timestamp < self.timeout:
                return marker
            else:
                log.warn('Inconsistent app cache: dn={dn!r}, inserted={inserted!r}, current={current!r}',
                    dn=dn, inserted=timestamp, current=current_time
                )
        else:
            log.info('No entry in app cache for dn={dn!r}', dn=dn)
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号