{ "info": { "author": "Carlos Ferras", "author_email": "c4rlos.ferra5@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "## Ormuco Code Challenge\n\nThis project has been created only for demonstration purpose.\n>\n> ### The challenge\n>\n> At Ormuco, we want to optimize every bits of software we write. Your goal is to write a new library that can be integrated to the Ormuco stack. Dealing with network issues everyday, latency is our biggest problem. Thus, your challenge is to write a new Geo Distributed LRU (Least Recently Used) cache with time expiration. This library will be used extensively by many of our services so it needs to meet the following criteria:\n> 1. Simplicity. Integration needs to be dead simple.\n> 2. Resilient to network failures or crashes.\n> 3. Near real time replication of data across Geolocation. Writes need to be in real time.\n> 4. Data consistency across regions\n> 5. Locality of reference, data should almost always be available from the closest region\n> 6. Flexible Schema\n> 7. Cache can expire\u00a0\n>\n\n### The Answer\n\nsource directory: `./cache`\n\n>\n> This feature is not finished yet, but the idea to implement is:\n> 1. In each remote server create a local cache\n> 2. Each independent cache will have other 2 optional roles at the same time; as server cache and as client cache\n> 3. As server cache it will have the responsibility to synchronize all its client caches\n> 4. As client cache it will have the responsibility to notify its server cache each time a change occurs\n> 5. All this communication will be through sockets in independent threads each one\n> 6. If the connection gets broken in any point the caches networks remaining will continue working as independent networks\n> 7. If a server gets disconnected from the caches network, its cache will work locally without any problem\n> 8. The developer in charge to deploy the system will have the responsibility to decide which server is a cache server or client or both\n>\n\nusage:\n\n- Run `pip3 install cf_LRU_cache`\n\nusage for a local cache only: \n```\nfrom lru_cache.lru_cache import LRUCache\n\ndef load_callback(key):\n \"\"\"This function has the responsibility to load the content \n to store into the cache\n \"\"\"\n return key\n\nlocal_cache = LRUCache(\n load_callback=load_callback,\n maximum_capacity=5555,\n expiration_time=5555\n)\n\n# get data from the cache; it will call `load_callback` if the \n# value is not available\ndata_from_cache = local_cache.get('test_key')\n\n# set data manually into the cache\ndata_from_cache = local_cache.set('test_key', 'test_value')\n\n# More options are only documented into the source code\n```\n\nusage for a distributed cache: \n```\nfrom lru_cache.lru_cache_distributed import LRUCacheDistributed\n\ndef load_callback(key):\n \"\"\"This function has the responsibility to load the content \n to store into the cache\n \"\"\"\n return key\n\nlocal_cache = LRUCacheDistributed(\n load_callback=load_callback,\n maximum_capacity=5555,\n expiration_time=5555,\n connection_timeout=5555,\n remote_address=('192.168.1.1', '5555'), # to be a client\n local_address=('', '5555') # to be a server\n)\n\n# get data from the cache; it will call `load_callback` if the \n# value is not available\ndata_from_cache = local_cache.get('test_key')\n\n# set data manually into the cache\ndata_from_cache = local_cache.set('test_key', 'test_value')\n\n# More options are only documented into the source code\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/carlos-ferras/code-challenge/cache", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cf-LRU-cache", "package_url": "https://pypi.org/project/cf-LRU-cache/", "platform": "", "project_url": "https://pypi.org/project/cf-LRU-cache/", "project_urls": { "Homepage": "https://github.com/carlos-ferras/code-challenge/cache" }, "release_url": "https://pypi.org/project/cf-LRU-cache/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "LRU Cache Distributed", "version": "0.0.2" }, "last_serial": 5234518, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "681eb36ff7fa73d3c68c33ebc2293775", "sha256": "60450a75c53ff8c2c6949df91fdd3e33a4f771da9930793e2e6260e65a0130dd" }, "downloads": -1, "filename": "cf_LRU_cache-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "681eb36ff7fa73d3c68c33ebc2293775", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7425, "upload_time": "2019-05-06T19:24:20", "url": "https://files.pythonhosted.org/packages/c0/03/43c9657451725c851004d666198118ff0e1d9f59c98eb7d0a0871e289919/cf_LRU_cache-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd087e2ca3b5c38492dc585e04be4c1f", "sha256": "0619ad9a58eb405ea63e2747e771c242aca210828edc331eede115bf86c3a7a4" }, "downloads": -1, "filename": "cf_LRU_cache-0.0.1.tar.gz", "has_sig": false, "md5_digest": "cd087e2ca3b5c38492dc585e04be4c1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4412, "upload_time": "2019-05-06T19:24:23", "url": "https://files.pythonhosted.org/packages/e0/8f/5775d92b0ececd13c856ff556efabf3119e3ed3381882881cbda2bdcf581/cf_LRU_cache-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5f6faaf02874136761377a5686e7eda7", "sha256": "c05455d25882c0cb5028608ff16509aa57554d887f3b35865a77d3ec9d42d1c0" }, "downloads": -1, "filename": "cf_LRU_cache-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5f6faaf02874136761377a5686e7eda7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4352, "upload_time": "2019-05-06T19:35:57", "url": "https://files.pythonhosted.org/packages/5a/5c/33e92385c33a803d2e1cc9008eba62983ea5ac866d63584ab90a995ac636/cf_LRU_cache-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f6faaf02874136761377a5686e7eda7", "sha256": "c05455d25882c0cb5028608ff16509aa57554d887f3b35865a77d3ec9d42d1c0" }, "downloads": -1, "filename": "cf_LRU_cache-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5f6faaf02874136761377a5686e7eda7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4352, "upload_time": "2019-05-06T19:35:57", "url": "https://files.pythonhosted.org/packages/5a/5c/33e92385c33a803d2e1cc9008eba62983ea5ac866d63584ab90a995ac636/cf_LRU_cache-0.0.2.tar.gz" } ] }