Cache¶
We offer a cache system that significantly speeds up the operation of websites. It is intended as a replacement for the previously supported Varnish.
Configuration¶
OPTION cache
control
- cache fully managed by headers (sent by the running application) such asCache-Control
,Expires
, orPragma
short
- set cache to1 second
(microcaching
)long
- set cache to120 seconds
purge
- clear cacheoff
- disable cache
OPTION cache_cookie
any
- ignore cookies (page cached every time)none
- only requests without cookiesname
- specify cookie name that can be used to differentiate users and serve them different cache versions
OPTION cache_debug
on
- enable debug informationoff
- disable debug information
Devil¶
Command syntax:
devil www options DOMAIN cache control|short|long|purge|off
devil www options DOMAIN cache_cookie any|none|name
devil www options DOMAIN cache_debug on|off
DevilWEB¶
Cache options are also available in the DevilWEB panel: WWW websites
➡ Details
for the selected page.
Examples¶
Here are a few examples of use:
- For high traffic pages and no separation of content for users (e.g. blog without commenting, statistics page) - cache:
long
, cache_cookie:any
. - For high traffic pages, with user login - but with content that rarely changes: cache:
long
, cache_cookie:USER_SESSION
(e.g.PHPSESSID
for PHP orsessionid
for Django). - For pages with content that changes very often - e.g. forums: cache:
short
, cache_cookie:USER_SESSION
(e.g.PHPSESSID
for PHP orsessionid
for Django). - For practically any application that controls cache using headers such as:
Cache-Control
,Expires
, orPragma
- cache:control
, cache_cookie:USER_SESSION
(e.g.PHPSESSID
for PHP orsessionid
for Django).
Debug¶
When the debug_cache
option is enabled, headers
are added to each server response to inform about cache usage:
X-DCache-KEY
: this is the exact key that was used to identify the cache.X-DCache-Status
: cache usage status:MISS
,EXPIRED
orHIT
.