This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A Really! Small! Cache! for python 2 and 3.

Why?

Working on a totally separate project, I found myself wanting to use funcy.memoize…a lot. There was a major problem, though: I couldn’t test with it. There was no (obvious) way to turn it off. It was making me crazy, so I spent a few hours writing a small module (even smaller than this, originally) to suit the memoization needs, with a hook to turn it off for testing. When I got to the end of my feature sprint for that project, I decided it made more sense to spin it out into its own project, so here we are!

Current features

  • Simple upsert and get workflow
  • Decorator for “memoization”
  • Enabling and disabling functionality, including a context manager
  • Work directly on the imported module… no additional instantiation

Installation

pip install microcache

Examples

Basic usage

>>> import microcache
>>> microcache.has('key')
False
>>> microcache.get('key', default='default')
'default'
>>> microcache.upsert('key', 'value')
>>> microcache.get('key')
'value'
>>> microcache.disable()
>>> microcache.get('key')

Decorator and context manager

import microcache
import time

@microcache.this
def somefunc():
    time.sleep(5)
    return "this will be cached, and you won't have to wait a second time!"

def test_somefunc():
    somefunc()
    somefunc()
    with microcache.temporarily_disabled():
        # now we'll have to wait again
        somefunc()
Release History

Release History

0.2.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
microcache-0.2.1-py2.py3-none-any.whl (3.8 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Mar 8, 2016
microcache-0.2.1.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Mar 8, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting