caching

How to cache pip packages within Azure Pipelines

How to cache pip packages within Azure Pipelines Question: Although this source provides a lot of information on caching within Azure pipelines, it is not clear how to cache Python pip packages for a Python project. How to proceed if one is willing to cache Pip packages on an Azure pipelines build? According to this, …

Total answers: 3

how can I clear specific streamlit cache?

how can I clear specific streamlit cache? Question: I run streamlit script with a few caches. When I use the following code it clears all the caches: from streamlit import caching caching.clear_cache() I would like to clear only a specific cache. How can I do this? Asked By: theletz || Source Answers: This isn’t currently …

Total answers: 2

Disable joblib.memory caching globally during unittest

Disable joblib.memory caching globally during unittest Question: I use the joblib.Memory module to cache some functions within several modules. The cache is initialized within modules and classes separately. Module1: memory = Memory(location=’/cache/’) @memory.cache def heavy_function(…) ….. Module2: memory = Memory(location=’/cache/’) @memory.cache def heavy_function2(…) ….. Module3: import Module1 import Module2 def heavy_function3(…) Module1.heavy_function1(…) Module1.heavy_function1(…) ….. Now …

Total answers: 3

How does Lru_cache (from functools) Work?

How does Lru_cache (from functools) Work? Question: Especially when using recursive code there are massive improvements with lru_cache. I do understand that a cache is a space that stores data that has to be served fast and saves the computer from recomputing. How does the Python lru_cache from functools work internally? I’m Looking for a …

Total answers: 3

Preventing pytest from creating .cache directories in Pycharm

Preventing pytest from creating .cache directories in Pycharm Question: I’m using Pycharm for this years Advent of Code and I’m using pytest for testing all of the examples and output. I’d prefer it if pytest didn’t create the .cache directories throughout my directory tree. Is there anyway to disable the creation of .cache directories when …

Total answers: 1

How to cache Django Rest Framework API calls?

How to cache Django Rest Framework API calls? Question: I’m using Memcached as backend to my django app. This code works fine in normal django query: def get_myobj(): cache_key = ‘mykey’ result = cache.get(cache_key, None) if not result: result = Product.objects.all().filter(draft=False) cache.set(cache_key, result) return result But it doesn’t work when used with django-rest-framework api calls: …

Total answers: 2

Un-persisting all dataframes in (py)spark

Un-persisting all dataframes in (py)spark Question: I am a spark application with several points where I would like to persist the current state. This is usually after a large step, or caching a state that I would like to use multiple times. It appears that when I call cache on my dataframe a second time, …

Total answers: 3

Decorator for a class method that caches return value after first access

Decorator for a method that caches return value after first access Question: My problem, and why I’m trying to write a decorator for a method, @cachedproperty. I want it to behave so that when the method is first called, the method is replaced with its return value. I also want it to behave like @property …

Total answers: 8

Caching urls with Bottlenose python Amazon product advertising API

Caching urls with Bottlenose python Amazon product advertising API Question: i would like to find a way to use the cache function with bottlenose, i found somewhere that i can do it with this code but unfortunately i don’t know what to import to work with the cache : def reader(cache_url): return cache.ram(cache_url,lambda: None,time_expire=86400) #Time …

Total answers: 1

Disabling caching in Flask

Disabling caching in Flask Question: I have some caching issues. I’m running very small web-application which reads one frame, saves it to the disk and then shows it in browsers window. I know, it is probably not the best solution, but every time I save this read frame with the same name and therefor any …

Total answers: 4