知道如何在 memcache 中搜索字符串,我有一个加载到 memcache 上的域列表
我想做的是在这些域上搜索一个字符串......
[root@server python]# cat memtest.py
#!/usr/bin/env python
import os
import sys
import memcache
domain = "http://www.yahoo.com/images.txt"
s = memcache.Client(["127.0.0.1:11211"])
def addData():
proc = open("domains.txt","r")
for i in proc.readlines():
d = i.rstrip("\n");
s.set(d,1)
def getData():
name = s.get("yahoo.com")
print name
name = s.get("xaa.com")
print name
##dummy code, just an example
if domain in s.get(domain):
print found
def main():
addData()
getData()
if __name__ == "__main__":
main()