Metadata-Version: 2.1
Name: cache-to-disk
Version: 0.0.1
Summary: Local disk caching decorator for python function.
Home-page: https://github.com/sarenehan/cache_to_disk
Author: Stewart Renehan
Author-email: sarenehan@gmail.com
License: UNKNOWN
Description: # cache_to_disk
        Local disk caching decorator for python functions.
        
        This is intended to cache functions that both take a long time to run, and have return values that take up too much memory to cache in-memory with redis. The results of the function are pickled and saved to a file, and then unpickled and returned the next time the function is called. The caching is argument specific, so if the function is called with different arguments, the function will be run again. The caching decorator accepts an integer representing the number of days to cache the function for. After this many days, the file for that function will be deleted the next time this module is imported.
        
        # Functions:
        cache_to_disk(n_days_to_cache)
        delete_disk_caches_for_function(function_name)
        delete_old_disk_caches()
        
        
        # Examples:
        **cache_to_disk##
        ```python
        """
        This example caches the function "my_function" for 3 days.
        """
        
        from cache_to_disk import cache_to_disk
        
        @cache_to_disk(3)
        def my_function():
            to_return = []
            for i in range(10000):
                for j in range(i):
                    to_return.append(i * j ** .23)
            return to_return
        ```
        **delete_disk_caches_for_function**
        
        ```python
        """
        This example invalidates all of the caches for the function "my_function"
        """
        from cache_to_disk import cache_to_disk
        
        
        @cache_to_disk(3)
        def my_function():
            to_return = []
            for i in range(10000):
                for j in range(i):
                    to_return.append(i * j)
        ```
        
        **delete_disk_caches_for_function**
        
        ```python
        """
        This example invalidates all of the caches for the function "my_function"
        """
        
        from cache_to_disk import delete_disk_caches_for_function
        delete_disk_caches_for_function('my_function')
        ```
        
        **delete_old_disk_caches**
        ```python
        """
        This example invalidates all of the caches for the function "my_function"
        """
        
        from cache_to_disk import delete_old_disk_caches
        delete_old_disk_caches()
        ```
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
