|
|
|
|
|
by vngzs
2583 days ago
|
|
You can use a closure to pass in the configuration. def configure_memcache(client_ip, port):
client = pymemcache.client.Client((client_ip, port))
@ring.memcache(client, expire=60)
def get_url(url):
return requests.get(url).content
return get_url
Then in your code which imports the above library: get_url = configure_memcache('127.0.0.1', 11211)
result = get_url('https://www.google.com')
|
|