From b4855552c4b04b14faf3c04a4350b1450ba8fa6e Mon Sep 17 00:00:00 2001 From: Webysther Sperandio Date: Fri, 20 Sep 2024 11:02:49 +0200 Subject: [PATCH 1/3] Update README.rst with details about cache --- README.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.rst b/README.rst index c874cf3..bbf9696 100644 --- a/README.rst +++ b/README.rst @@ -32,3 +32,15 @@ m'South Korean singer and actress' 'https://upload.wikimedia.org/wikipedia/commons/6/60/KBS_%22The_Producers%22_press_conference%2C_11_May_2015_10.jpg' .. _Wikidata: https://www.wikidata.org/ + +Sample usage with cache ``pip install cachelib``: + +>>> from wikidata.client import Client +>>> from cachelib.file import FileSystemCache +>>> +>>> wikidata_cache = wikidata.cache.ProxyCachePolicy( +>>> timeout=3600*24*30, # One month cache in seconds +>>> FileSystemCache( +>>> "/tmp/wikidata" +>>> ) +>>> client = Client(cache_policy=wikidata_cache) From 84cabaa2c20eeb7f633796933161d5d27d8424da Mon Sep 17 00:00:00 2001 From: Webysther Sperandio Date: Sun, 22 Sep 2024 05:47:40 +0200 Subject: [PATCH 2/3] Update README.rst --- README.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.rst b/README.rst index bbf9696..c874cf3 100644 --- a/README.rst +++ b/README.rst @@ -32,15 +32,3 @@ m'South Korean singer and actress' 'https://upload.wikimedia.org/wikipedia/commons/6/60/KBS_%22The_Producers%22_press_conference%2C_11_May_2015_10.jpg' .. _Wikidata: https://www.wikidata.org/ - -Sample usage with cache ``pip install cachelib``: - ->>> from wikidata.client import Client ->>> from cachelib.file import FileSystemCache ->>> ->>> wikidata_cache = wikidata.cache.ProxyCachePolicy( ->>> timeout=3600*24*30, # One month cache in seconds ->>> FileSystemCache( ->>> "/tmp/wikidata" ->>> ) ->>> client = Client(cache_policy=wikidata_cache) From e2bbc7a7251269948545e848206528c127743e24 Mon Sep 17 00:00:00 2001 From: Webysther Sperandio Date: Sun, 22 Sep 2024 05:48:06 +0200 Subject: [PATCH 3/3] Update cache.rst --- docs/wikidata/cache.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/wikidata/cache.rst b/docs/wikidata/cache.rst index 7c2a873..d3e7f9a 100644 --- a/docs/wikidata/cache.rst +++ b/docs/wikidata/cache.rst @@ -5,3 +5,15 @@ .. automodule:: wikidata.cache :members: + +Sample usage with cache ``pip install cachelib``: + +>>> from wikidata.client import Client +>>> from cachelib.file import FileSystemCache +>>> +>>> wikidata_cache = wikidata.cache.ProxyCachePolicy( +>>> timeout=3600*24*30, # One month cache in seconds +>>> FileSystemCache( +>>> "/tmp/wikidata" +>>> ) +>>> client = Client(cache_policy=wikidata_cache)