_get_all_threadstore

privex.helpers.plugin._get_all_threadstore(name=None) → Generator[Tuple[Union[int, str], Union[Dict[str, Any], Any]], None, None][source]

Get the 'redis' key from every thread in the thread store:

>>> for t_id, inst in _get_all_threadstore('redis'):
...     inst.close()
...
>>> clean_threadstore(name='redis')

Get the thread store for every single thread:

>>> for t_id, ts in _get_all_threadstore():
...     if 'redis' in ts: print(t_id, 'has redis instance!')
...     if 'aiomemcached' in ts: print(t_id, 'has asyncio memcached instance!')
Parameters

name (str) – Yield only this key from each thread store (if it exists)

Return Generator store_gen

A generator of tuples containing either (thread_id, thread_store: dict), or (t_id, value) depending on whether name is empty or not.