Skip to content

Give you an extra router condiiton by which you can check if a given file is to be considered "fresh" or if it is outdated.

License

Notifications You must be signed in to change notification settings

Timusan/uwsgi-router-isfreshfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uwsgi-router-isfreshfile

Gives you an extra router condition by which you can check if a given file is to be considered "fresh" or if it is outdated. The check is done against the file's last modified timestamp.

Usage

route-if = isfreshfile:<path-to-file>,<age> other-action:...

You need to include the path to the full file you wish to check for freshness and provide the maximum allowed age in seconds.

Flat file caching with expiration

This plugin is part of a set of tiny plugins which aims to give the user flat file caching with sane directory structure and file expiration.

Other plugins in this set:

With the above plugin you can create a directory structure based on any available variable.

Complete usage example:

# Check if the cached file is fresh (86400 = 24 hours), if so serve it directly.
route-if = isfreshfile:/tmp/uwsgi_cache${PATH_INFO}file.html,86400 static:/tmp/uwsgi_cache${PATH_INFO}file.html
# Not fresh or does not exist? Create the full directory structure first.
route = .* mkdir:/tmp/uwsgi_cache${PATH_INFO}
# And (re)create the cached response file.
route-run = tofile:filename=/tmp/uwsgi_cache${PATH_INFO}file.html

Big thanks to Roberto for his support!

About

Give you an extra router condiiton by which you can check if a given file is to be considered "fresh" or if it is outdated.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published