pandaspgs.client

clear_cache

clear_cache(field: str = 'All') -> None

Clear some or all of the cache pools.

Parameters:
  • field (str, default: 'All' ) –

    It can be one of the following: 'All', 'Score', 'Publication', 'Trait', 'Trait_category', 'Performance', 'Cohort', 'Sample_set', 'Release', 'Ancestry_category'

Returns:
  • None

    None

from pandaspgs.get_publication import get_publications
from pandaspgs.client import clear_cache

# Clear all caches.
clear_cache('All')
pub = get_publications()
# Clear the cache used by get_publications()
clear_cache('Publication')
pub = get_publications()

reinit_cache

reinit_cache(
    field: str = "All",
    maxsize: int = 2 * 1024,
    ttl: int = 60 * 60 * 24,
) -> None

Reinitialize some or all of the cache pools.

Parameters:
  • field (str, default: 'All' ) –

    It can be one of the following: 'All', 'Score', 'Publication', 'Trait', 'Trait_category', 'Performance', 'Cohort', 'Sample_set', 'Release', 'Ancestry_category'

  • maxsize (int, default: 2 * 1024 ) –

    The number of HTTP requests that can be stored in the cache pool.

  • ttl (int, default: 60 * 60 * 24 ) –

    The unit is seconds. Expiration time.

Returns:
  • None

    None

from pandaspgs import get_publications, reinit_cache

# Reinitialize all the cache pools. Each cache pool can only store 10 HTTP requests, and the expiration time is 10 seconds.
reinit_cache(field = 'All', maxsize = 10, ttl = 10)
pub = get_publications()
# Reinitialize the cache used by get_publications()
reinit_cache(field = 'Publication', maxsize = 10, ttl = 10)
pub = get_publications()