wsgi_cache

WSGI middleware for caching responses to disk
Download

wsgi_cache Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Nathan R. Yergler
  • Publisher web site:

wsgi_cache Tags


wsgi_cache Description

WSGI middleware for caching responses to disk wsgi_cache is a piece of WSGI middleware which provides disk caching for WSGI applications. It is somewhat coarse and rather inflexible, sort of like your grandpa.wsgi_cache is designed to cache requests to a WSGI site to disk in a cache directory on disk. The cache directory will have the same directory layout as the requests (ie, if /foo/bar is requested, the foo directory will be made in the cache and bar will be stored there). There is no cache expiration beyond deleting cached files from the disk. This is a feature.Installation:wsgi_cache can be installed as a Python egg, using easy_install:easy_install wsgi_cacheConfigurationConfiguration of wsgi_cache will often be done using Paste Deploy. In this situation, it can be configured as a filter:use = egg:my_wsgi_app#appfilter-with = cacheuse = egg:wsgi_cache#middlewarecache_dir = ./cacheThe cache_dir is the only required configuration parameter, and will be interpreted as relative to global_conf.wsgi_cache also supports two additional configuration parameters: * content_type Specifies the content type used when serving cached resources; see Limitations below for details on this. By default this is set to text/html. * cache_paths A comma separated list of paths, starting with a /, that specifies the paths to cache. If specified, only requests to paths starting with one of these strings will be cached.BehaviorWhen a request comes in, wsgi_cache examines the path to determine if it should be cached. Requests with a querystring are not cached, regardless of the use of cache_paths. If the request is supposed to be cached, wsgi_cache looks for the page in the cache and serves that copy, if available. If unavailable, the request is passed to the application and the result is saved and returned.Note that in many situations, you'll want to exploit wsgi_cache's on disk cache layout to serve the cached version directly using your front end web server (ie, Apache with mod_rewrite).Developmentwsgi_cache may be developed using buildoutpython bootstrap.py./bin/buildoutThis will install any dependencies, as well as create a wrapper python script that can be used to run a shell with wsgi_cache on the Python path.Running Testswsgi_cache uses nose for running tests. You can run the test suite by running:python setup.py nosetestsIf you're using buildout for development, nose will be installed in the buildout for you:./bin/python setup.py nosetests Requirements: · Python Limitations: · wsgi_cache only stores the response body in order to allow serving of the cached files by a faster, static webserver. As such, it can only return a single content-type at this point.


wsgi_cache Related Software