示例#1
0
文件: memcached.py 项目: oktomus/rez3
    def client(self):
        """Get the native memcache client.

        Returns:
            `memcache.Client` instance.
        """
        if self._client is None:
            self._client = Client_(self.servers)
        return self._client
示例#2
0
文件: memcached.py 项目: mwiebe/rez
    def client(self):
        """Get the native memcache client.

        Returns:
            `memcache.Client` instance.
        """
        if self._client is None:
            #print "Connected memcached client %s" % str(self)
            self._client = Client_(self.servers)
        return self._client
示例#3
0
文件: memcached.py 项目: oktomus/rez3
    def test_servers(self):
        """Test that memcached servers are servicing requests.

        Returns:
            set: URIs of servers that are responding.
        """
        responders = set()
        for server in self.servers:
            client = Client_([server])
            key = uuid4().hex
            client.set(key, 1)
            if client.get(key) == 1:
                responders.add(server)
        return responders