Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    repoze.lru 0.6

    Download button

    No screenshots available
    Downloads: 127  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Agendaless Consulting | More programs
    BSD License / FREE
    July 14th, 2012, 02:45 GMT [view history]
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    repoze.lru description

    A tiny LRU cache implementation and decorator

    repoze.lru is a LRU (least recently used) cache implementation and decorator. Keys and values that are not used frequently will be evicted from the cache faster than keys and values that are used frequently. It works under Python 2.5, Python 2.6, Python 2.7, and Python 3.2.

    API

    Creating an LRUCache object:

    from repoze.lru import LRUCache
    cache = LRUCache(100) # 100 max length


    Retrieving from an LRUCache object:

    cache.get('nonexisting', 'foo') # will return 'foo'
    cache.get('nonexisting') # will return None
    cache.get('existing') # will return the value for existing


    Adding to an LRUCache object:

    cache.put('key', 'value') # will add the key 'key' with the value 'value'

    Clearing an LRUCache:

    cache.clear()

    Decorator

    A lru_cache decorator exists. All values passed to the decorated function must be hashable. It does not support keyword arguments:

    from repoze.lru import lru_cache

    @lru_cache(500)
    def expensive_function(*arg):
     pass


    Each function decorated with the lru_cache decorator uses its own cache related to that function.


    Product's homepage

    Requirements:

    · Python

    What's New in This Release: [ read full changelog ]

    · Added a 'CacheMaker' helper class: a maker keeps references (by name) to the caches it creates, to permit them to be cleared.
    · Added statistics to each cache, tracking lookups, hits, misses, and evictions.
    · Automated building Sphinx docs and testing example snippets under tox.
    · Added Sphinx documentation.
    · Dropped support for Python 2.5.
    · Added support for PyPy.
    · Added setup.py docs alias (installs Sphinx and dependencies).
    · Added setup.py dev alias (runs develop plus installs nose and coverage).
    · Added support for CI under supported Pythons using tox.
    · Bug: Remove potential race condition on lock in face of interrupts (Issue #10).

      


    TAGS:

    tiny LRU | cache implementation | cache decorator | tiny | LRU | cache

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM