Προσωρινή μνήμη

Τελευταία ενημέρωση από Elxis Team

Speed up your site by using file cache and APC

When a user requests a page Elxis computes this request and generates the proper HTML output. This procedure might be slow especially if complex queries have to be executed against the database. By using cache Elxis will store the generated output elsewhere than the database so that future requests for that data can be retrieved from cache and thus served faster. Elxis has 2 caching options that can be used independantly from the other, file cache and APC.

File cache

The final generated output is stored as a flat file in Elxis repository (repository/cache/). Elxis will store in cache language specific versions of each item. For instance if you have a module displaying the weather and you see the page in English, Elxis will create a cached version of the Weather module in English. If you switch language to Greek a new cache will be created for this item for the Greek language. Now each time a user switches language Elxis will retrieve from the cache the proper language version of the cached item.

module caching
Elxis 4.x gives you one more cool feature, the option to cache an element based on the user access or login status. You can set a module to be cached only for visitors or for all (both visitors and logged in users). Modules that have the same output for everyone should be cached for all. Others, that change their output depending on the user login status, should be cached only for visitors. An example is the login module. This module for visitors displays a login form, but for already logged-in users it shows the user's username and the option to logout. If we cache this module for everyone then either the logged-in users will see the login form (but they are already logged-in!), or the visitors will see that they are logged in and a button to logout (but they haven't logged in!). So, for that module the wise option is to cache it only for visitors.


APC

APC is free and open opcode cache for PHP. Elxis uses it to store PHP intermediate code into server's memory. As retriving things from the RAM is extremely fast by using APC you will get a speed boost for your site on specific relative slow areas.

APC will not store HTML output in the memory but only PHP intermediate code. What this means? Well, consider you have a program that needs to execute a difficult mathematical equation. We will need many CPU resources and possible database queries to solve this equation. And the worst is that we have to execute this process on every user click! By using APC we store the result of this mathematical equation into the memory and so we dont have to calculate it again and again.

APC cache is fully controlled by Elxis core and extensions. You only have to enable it in configuration and Elxis will do the rest automatically. Off course it must be supported by your server's setup inorder to use it.


Global settings

cache settings Cache can be controlled globally in Elxis configuration.
The related caching options are:
Cache Enable or not file caching.
Lifetime The time till the cached item is refreshed. This is a global option. You can change that in idividual items.
APC Enable or not APC cache.
APC Id A unique integer on the server used to separate cached items from different sites (like an Elxis multisite).

 

Manage cached items

With the Elxis cache manager (Site -> Cache) you can view cached items for both file and APC caching methods. For each item you can see the time passed since its last update and its size in KB. You can select any for these items and delete it. By deleting an item you force the re-generation of it. This is very useful if you made changes to a module and you want to immediately display the updated version of it and don't wait till cache expires.
cache manager



 

Έχει διαβαστεί 5156 φορές
Cron jobs
Προηγούμενο άρθρο
Cron jobs
Πολλαπλοί ιστότοποι
Επόμενο άρθρο
Πολλαπλοί ιστότοποι

Μπορείτε να αντιγράψετε, διανείμετε και παρουσιάσετε τα άρθρα αυτού του ιστότοπου για μη εμπορικούς σκοπούς.
Creative Commons 3.0