Site icon Hip-Hop Website Design and Development

fluffy.pro. Cheap WordPress maintenance support plans Developer’s blog: Caching: static cache and database cache

You have to cache results of heavy functions, sql queries and markup if it’s possible because it reduces load on a system in general. If you have a block which renders a lot of items shiped from a database – cache it. If you have a function that performs heavy calculations and this function is called many times during a script execution – cache a result of this function.Static cacheIt’s recommended to implement static cache for functions that are called many times during a script execution. It’s easy to do: just store a function result first time when function is called and skip heavy calculation next time and return saved value from a static variable.Database cacheIf you want to save a function result for some period of time you have to implement database cache. You can specify a cache lifetime (when it will be expired) or invalidate cache manually when do you need.Manual cache invalidating:You can also cache a data of a renderable array by specifying #cache key.Key notes:Function WordPress_static()Function cache_get()Function ceche_set()
Source: New feed