This article needs additional citations for verification. (March 2021)
Funky caching is the generation, display and storage of dynamic content when a requested static web page resource is not available.
The name is based on the idea of treating the web server, serving static pages, as a cache. However, unlike common reverse caches, the funky cache is part of the web server software, and has the ability to dynamically generate this content.
It assumes that all pages are potentially generatable on-demand. If they are not, the conventional HTTP 404 error is returned, as usual.
The overall advantage is relatively small, compared to a conventional cache. Architecturally it is also a poor design. However it does allow small sites with no separate cache layer to achieve some of the advantages of caching (albeit a little inflexibly). This is why it became popular at one time for small, single-server dynamic web sites, particularly those built within the PHP community, where the technique originated.
A drawback to the technique is that it requires the web server process to have write access to the web content space. For security reasons, this is not usually required or permitted.
It is also known as the
ErrorDocument trick, Smarter Caching and Rasmus' Trick, the latter name in honor of Rasmus Lerdorf, creator of the PHP programming language, who was allegedly the first to present this mechanism (though it is also attributed to Stig Bakken).
One common usage is the replacement of the HTTP Error404 ErrorDocument with a dynamic script.
Another way to look at it as a variation of the cache-aside pattern where, instead of reading the data from the data store, it is generated dynamically, and where the implementation spans an architecture (in this case the Web server and the Web app language) instead of being implemented in a single system.