예제 #1
0
    def __refreshUserCache(self, validSeconds=0):
        """Refresh user cache

        :param int validSeconds: required seconds the proxy is valid for

        :return: S_OK()/S_ERROR()
        """
        rpcClient = Client(url="Framework/ProxyManager", timeout=120)
        retVal = rpcClient.getRegisteredUsers(validSeconds)
        if not retVal["OK"]:
            return retVal
        data = retVal["Value"]
        # Update the cache
        for record in data:
            cacheKey = (record["DN"], record["group"])
            self.__usersCache.add(
                cacheKey,
                self.__getSecondsLeftToExpiration(record["expirationtime"]),
                record)
        return S_OK()