Metadata-Version: 1.1
Name: cacheout
Version: 0.1.0
Summary: A caching library for Python
Home-page: https://github.com/dgilland/cacheout
Author: Derrick Gilland
Author-email: dgilland@gmail.com
License: MIT License
Description-Content-Type: UNKNOWN
Description: cacheout
        ********
        
        |version| |travis| |coveralls| |license|
        
        
        A caching library for Python.
        
        
        Links
        =====
        
        - Project: https://github.com/dgilland/cacheout
        - Documentation: https://cacheout.readthedocs.io
        - PyPI: https://pypi.python.org/pypi/cacheout/
        - TravisCI: https://travis-ci.org/dgilland/cacheout
        
        
        Features
        ========
        
        - In-memory caching using dictionary backend
        - Maximum cache size enforcement
        - Cache-level default TTL (time-to-live) as well as custom TTLs on a per cache entry basis
        - Reconfigurable cache settings for runtime setup when using module-level cache objects
        - Bulk set, get, and delete operations
        - Thread-safe
        
        
        Roadmap
        =======
        
        - Additional cache replacement policies:
        
          - LRU (Least Recently Used)
          - MRU (Most Recently Used)
          - LFU (Least Frequently Used)
          - LIFO (Last In, First Out)
          - RR (Random Replacement)
        
        - Memoization decorator
        - Layered caching (multi-level caching)
        - Cache handler (multi-cache access layer)
        - Cache event listener support (e.g. on-get, on-set, on-delete)
        - Regular expression support in cache get
        - Set-on-missing callback support in cache get
        - Cache statistics (e.g. cache hits/misses, cache frequency, etc)
        
        
        Requirements
        ============
        
        - Python >= 3.4
        
        
        Quickstart
        ==========
        
        Install using pip:
        
        
        ::
        
            pip install cacheout
        
        
        Let's start with some basic caching by creating a cache object:
        
        .. code-block:: python
        
            from cacheout import Cache
        
            cache = Cache()
        
        
        By default the ``cache`` object will have a maximum size of ``300`` and TTL expiration turned off. These values can be set with:
        
        .. code-block:: python
        
            cache = Cache(maxsize=300, ttl=0, timer=time.time)  # defaults
        
        
        Set a cache key using ``cache.set()``:
        
        .. code-block:: python
        
            cache.set(1, 'foobar')
        
        
        Get the value of a cache key with ``cache.get()``:
        
        .. code-block:: python
        
            assert cache.get(1) == 'foobar'
        
        
        Set the TTL (time-to-live) expiration when caching:
        
        .. code-block:: python
        
            cache.set(3, {'data': {}}, ttl=1)
            assert cache.get(3) == {'data': {}}
            time.sleep(1)
            assert cache.get(3) is None
        
        
        Get a copy of the entire cache with ``cache.copy()``:
        
        .. code-block:: python
        
            assert cache.copy() == {1: 'foobar', 2: ('foo', 'bar', 'baz')}
        
        
        Delete a cache key with ``cache.delete()``:
        
        .. code-block:: python
        
            cache.delete(1)
            assert cache.get(1) is None
        
        
        Clear the entire cache with ``cache.clear()``:
        
        .. code-block:: python
        
            cache.clear()
            assert len(cache) == 0
        
        
        Perform bulk operations with ``cache.set_many()``, ``cache.get_many()``, and ``cache.delete_many()``:
        
        .. code-block:: python
        
            cache.set_many({'a': 1, 'b': 2, 'c': 3})
            assert cache.get_many(['a', 'b', 'c']) == {'a': 1, 'b': 2, 'c': 3}
            cache.delete_many(['a', 'b', 'c'])
            assert cache.count() == 0
        
        
        Reconfigure the cache object after creation with ``cache.setup()``:
        
        .. code-block:: python
        
            cache.setup(maxsize=1000, ttl=5 * 60)
        
        
        Get keys, values, and items from the cache with ``cache.keys()``, ``cache.values()``, and ``cache.items()``:
        
        .. code-block:: python
        
            cache.set_many({'a': 1, 'b': 2, 'c': 3})
            assert list(cache.keys()) == ['a', 'b', 'c']
            assert list(cache.values()) == [1, 2, 3]
            assert list(cache.items()) == [('a', 1), ('b', 2), ('c', 3)]
        
        
        Iterate over cache keys:
        
        .. code-block:: python
        
            for key in cache:
                print(key, cache.get(key))
                # 'a' 1
                # 'b' 2
                # 'c' 3
        
        
        Check if key exists with ``cache.has()`` and ``key in cache``:
        
        .. code-block:: python
        
            assert cache.has('a')
            assert 'a' in cache
        
        
        For more details, see the full documentation at https://cacheout.readthedocs.io.
        
        
        
        .. |version| image:: https://img.shields.io/pypi/v/cacheout.svg?style=flat-square
            :target: https://pypi.python.org/pypi/cacheout/
        
        .. |travis| image:: https://img.shields.io/travis/dgilland/cacheout/master.svg?style=flat-square
            :target: https://travis-ci.org/dgilland/cacheout
        
        .. |coveralls| image:: https://img.shields.io/coveralls/dgilland/cacheout/master.svg?style=flat-square
            :target: https://coveralls.io/r/dgilland/cacheout
        
        .. |license| image:: https://img.shields.io/pypi/l/cacheout.svg?style=flat-square
            :target: https://pypi.python.org/pypi/cacheout/
        
        
        Changelog
        =========
        
        
        v0.1.0 (2018-01-28)
        -------------------
        
        - Add ``Cache`` class.
        
Keywords: cacheout cache caching
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Topic :: Database
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
