Enhancement
Create a small caching layer in PHP
Issue description
Some resources rarley change. A subject page is generated dynamically every time although it does not change so frequently. Same goes for a feed. It is necessary to create a small caching mechanism in PHP, which avoids the dynamic generation of pages.
Developer comments
[http://pear.php.net/package/Cache_Lite, Cache Lite] makes a good impression. After some central coding i was possible to avoid recreating large pages. The system would affect the resource definition and would cache entries depending on the query string.
Additionally it would be necessary to make the system sensitive to the language the resource is delivered and also to the host, since the base is set in every page.
The general idea is to keep the cache simple for now, because it is very difficult to decide which update affects which resource. The simple principle for the moment is: the whole cache of a store is emptied on any POST, PUT, or DELETE to the store. Very simple.
The current solution system has the following features:
* a store cache can be easily put in effect for a class of resources
* a store cache can be made sensitive to varying representations of one resource
* a store cache is emptied when a PUT, POST or DELETE to the store is received
* a store cache can be cleared manually via the command line very easily by removing the directory below tmp/cache_lite
* a store cache can be reset via the browser by calling admin/.clear-cache
This simple solution yields quite impressive results. With an active store cache 50 identical requests take 4.6 seconds. Without the cache they take 82 seconds!
|
Work sessions5
Start |
2009-07-11T06:57:55
|
End |
2009-07-11T08:28:30
|
Participant |
Robert Cerny
|
Summary |
I fiddeled around with [http://pear.php.net/package/Cache_Lite, Cache Lite]. No final code produced, just took a look.
|
Start |
2009-07-13T12:09:49
|
End |
2009-07-13T13:23:30
|
Participant |
Robert Cerny
|
Summary |
I improved the existing but not final code. I still need a good solution for varying the response depending on language (ui language and content language) and format (jtm, xtm1, xtm2).
|
Start |
2009-07-13T17:05:08
|
End |
2009-07-13T18:07:04
|
Participant |
Robert Cerny
|
Summary |
I made some progress regarding the language variation. Format variation is more difficult as is the setting of the correct headers.
|
Start |
2009-07-14T08:02:08
|
End |
2009-07-14T12:06:05
|
Participant |
Robert Cerny
|
Summary |
* I managed to get the header stored aways in the cache and set correctly upon delivering the cached response to the client.
* The declaration of a resource to be cached is fairly self explanatory, does not require a lot of knowledge and can be done within a minute max.
* I implemented all functionality in a near final state.
|
Start |
2009-07-14T13:34:58
|
End |
2009-07-14T16:07:19
|
Participant |
Robert Cerny
|
Summary |
I implemented the remaining functionality (clearing the cache on modification) and made the code final. Currently the feeds and subject pages and article pages are cached to see how that works.
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.