Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A process-safe python adapter to handle cache expiration.

Project Description
|Build Status|


Python utilities and middleware for neuron.js

expirecache analyzes the dependencies from user defined facades according
to the dependency tree, and outputs ``<script>`` tags and configurations
for `neuron.js <>`__

The dependency tree can be generated by
`neuron-package-dependency <>`__


.. code:: sh

$ pip install expirecache


.. code:: py

from expirecache import Neuron

n = Neuron(
dependency_tree=dependency_tree, # must defined

``expirecache`` could be used either in template file or your python

`Here <./sample/sample-jinja.html>`__ is a sample Jinja2 template file.

- **dependency\_tree** ``dict`` the ``json.loads()``\ ed dependency
- **resolve** ``function(id)=`` (optional) implements your own custom
resolver. ``resolve`` accepts one parameter ``id`` which can be
either a ``str`` of module id or a ``list`` of module ids. If a
``str`` is passed in, the method should returns the resolved absolute
url of the module id. If ``id`` is a ``list``, an url of comboed
script files should be returned.
- **debug** ``function|bool=False`` tells expirecache whether should
switch on debug mode. When on debug mode, no javascript files of
dependencies will be preloaded, and the output will not be
- if ``debug`` is callable, expirecache will use the return value of
method ``debug``
- if ``debug`` is a boolean value, and ``debug`` is true, the debug
mode will be on.
- **cache** ``dict=None`` if ``cache`` is defined, it should contains 3
- ``cache.has(key)`` returns ``bool``
- ``cache.get(key)`` looks up and returns the cached value by key
- ``cache.set(key, value)`` sets the value by key
- **version** ``str`` only works if ``cache`` is defined. expirecache will
uses ``version`` to generate the key to cache the output result

module id

.. code:: js

<name>@<version><path> # for example: 'jquery@2.0.0/jquery.js'

n.facade(entry, data=None)

- **entry** ``str`` id of the entry module

Registers a facade entry with ``data``. expirecache will

Returns ``''``\ (empty string), so you can use this method in python


Returns ``''``


Returns ``''``


Returns ``str``


Returns ``str``



.. |Build Status| image::
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
expirecache-1.0.0.tar.gz (1.5 kB) Copy SHA256 Checksum SHA256 Source Dec 3, 2015

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