Skip to content

Commit 0ee9d9f

Browse files
committed
Store chain by endpoint rather than chain name (i.e. "ws://finney.opentensor.org" vs "Bittensor"
1 parent 74f0aa7 commit 0ee9d9f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

async_substrate_interface/utils/cache.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import sqlite3
55
import asyncstdlib as a
66

7-
CACHE_LOCATION = os.path.expanduser("~/.cache/async-substrate_interface") if os.getenv("NO_CACHE") != "1" else ":memory:"
7+
CACHE_LOCATION = (
8+
os.path.expanduser("~/.cache/async-substrate_interface")
9+
if os.getenv("NO_CACHE") != "1"
10+
else ":memory:"
11+
)
812

913

1014
def _get_table_name(func):
@@ -55,7 +59,7 @@ def sql_lru_cache(func, max_size=None):
5559
def inner(self, *args, **kwargs):
5660
c = conn.cursor()
5761
key = pickle.dumps((args, kwargs))
58-
chain = self._chain
62+
chain = self.url
5963

6064
result = _retrieve_from_cache(c, table_name, key, chain)
6165
if result is not None:
@@ -79,7 +83,7 @@ def async_sql_lru_cache(func, max_size=None):
7983
async def inner(self, *args, **kwargs):
8084
c = conn.cursor()
8185
key = pickle.dumps((args, kwargs))
82-
chain = self._chain
86+
chain = self.url
8387

8488
result = _retrieve_from_cache(c, table_name, key, chain)
8589
if result is not None:

0 commit comments

Comments
 (0)