Skip to content

Commit

Permalink
Update and rename README.md to README.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentluce committed Dec 1, 2015
1 parent f487fe8 commit 979014c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 31 deletions.
31 changes: 0 additions & 31 deletions README.md

This file was deleted.

36 changes: 36 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

LFUCache
========

.. image:: https://img.shields.io/pypi/v/lfucache.svg
:target: https://pypi.python.org/pypi/LFUCache

Cache with LFU eviction scheme implemented in Python with complexity O(1) for insertion, access and deletion.

.. code-block:: python
>>> import lfucache.lfu_cache as lfu_cache
>>> cache = lfu_cache.Cache()
>>> cache.insert('k1', 'v1')
>>> cache.insert('k2', 'v2')
>>> cache.insert('k3', 'v3')
>>> cache
1: ['k1', 'k2', 'k3']
>>> cache.access('k2')
'v2'
>>> cache
1: ['k1', 'k3']
2: ['k2']
>>> cache.get_lfu()
('k1', 'v1')
>>> cache.delete_lfu()
>>> cache
1: ['k3']
2: ['k2']
More details: http://www.laurentluce.com/posts/least-frequently-used-cache-eviction-scheme-with-complexity-o1-in-python

0 comments on commit 979014c

Please sign in to comment.