Metadata-Version: 2.1
Name: lru-redis-cache
Version: 0.1
Summary: LRU Cache for Python using Redis
Home-page: https://github.com/estebansolo/david_solorzano_test/tree/master/question_c
Author: Esteban Solorzano
Author-email: estebansolorzano27@gmail.com
License: MIT
Description: # LRU Cache
        
        This is a simple Least Recently Used (LRU) Cache with expiration time that use redis to store the data.
        
        ## Installation
        
        
        ## Usage
        
        Import `LRUCache` from the lru_redis_cache module, when creating an instance of this class you could pass:
        
        - `cache_size`: Max size of the cache, the default value is 10
        - `ttl`: Max time to expire the cache, the default value is 60 seconds
        - `redis_host`: Host where the redis instance is allocated, default is localhost
        - `redis_port`: Redis port, default is 6379
        
        This class has three public methods to manage the cache:
        
        
        - `set(name, value)` this function set a new cache value or replace the previous.
        
        - `get(name)` this function return the cache element if it is stores, otherwise it will return a `None` value.
        
        - `set_connection(RedisConnection)` this function allows you to set the redis instance to be used.
        
        ```python
        from lru_redis_cache import LRUCache
        
        cache = LRUCache(cache_size=5, ttl=60)
        
        cache.set("my_key", "my_value")
        cache.get("my_key")
        
        # Output
        "my_value"
        ```
        
        ## Tests
        
        In order to run the test cases you need to install the basic requirements from `requirements.txt` by running the following command.
        
        `pip install -r requirements.txt`
        
        Then, you need to run
        
        `python -m pytest`
        
        ## Information
        
        [LRU Cache Implementation](https://www.geeksforgeeks.org/lru-cache-implementation/)
        
Keywords: LRU,Cache,Redis
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
