0
任何想法如何,我可以搜索在內存緩存中的字符串,我有被加載到內存緩存域列表蟒蛇memcache的搜索字符串
我想要做的是尋找那些域的串...
[[email protected] 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()
我需要另一種方式...如果域名在密鑰中... – krisdigitx
檢查這是否正常? – Rakesh