Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:cache:lscwp:api [2019/03/27 19:55]
Lisa Clarke [Nonce Issues]
litespeed_wiki:cache:lscwp:api [2020/05/04 13:55]
Shivam Saluja
Line 1: Line 1:
 ====== LSCache for WP Third Party Plugin Integration Framework ====== ====== LSCache for WP Third Party Plugin Integration Framework ======
 +**Please Note**: This wiki is valid for v2.9.x and below of the LiteSpeed Cache Plugin for WordPress. If you are using v3.0 or above, please see [[https://​docs.litespeedtech.com/​lscache/​lscwp/​overview/​|the new documentation]].
 +
 Any WordPress plugin that populates front-end content that can be publicly cached should work with LSCache. Any WordPress plugin that populates front-end content that can be publicly cached should work with LSCache.
  
Line 87: Line 89:
 ===== API ===== ===== API =====
 ==== Functions ==== ==== Functions ====
 +**This is only valid for v.2 of LSCWP since with v.3 all API functions have been replaced with hooks and the previous hooks have new names.
 +For assistance with migrating from v.2 to the refactored v.3 API please refer to the comments at [[https://​github.com/​litespeedtech/​lscache_wp/​blob/​master/​src/​api.cls.php#​L51|src/​api.cls.php under the init() function]] which has side-by-side comparisons & even lists hooks registered elsewhere.
 +See the [[https://​docs.litespeedtech.com/​lscache/​lscwp/​api/​|LSCWP v3 API documentation]] if starting new.
 +**
 +
 These functions are found in ''​plugins/​litespeed-cache/​inc/​api.class.php''​ and may be used in any hook point prior to the ''​shutdown''​ hook point. These functions are found in ''​plugins/​litespeed-cache/​inc/​api.class.php''​ and may be used in any hook point prior to the ''​shutdown''​ hook point.
  
Line 179: Line 186:
  
 === LiteSpeed_Cache_API::​nonce($string) === === LiteSpeed_Cache_API::​nonce($string) ===
-This creates an ESI block for WordPress'​ own "​create nonce" function, assigns it a TTL of 12 hours, and then calls ''​wp_create_nonce($string)''​. Essentially,​ you can cache the nonce function independently of the page it is on. This allows you to serve fully-cached pages even when they include a nonce. Replaces ''​wp_create_nonce($string)''​ in your code. +**Deprecated** ​This creates an ESI block for WordPress'​ own "​create nonce" function, assigns it a TTL of 12 hours, and then calls ''​wp_create_nonce($string)''​. Essentially,​ you can cache the nonce function independently of the page it is on. This allows you to serve fully-cached pages even when they include a nonce. Replaces ''​wp_create_nonce($string)''​ in your code. 
  
 +=== LiteSpeed_Cache_API::​nonce_action($string) ===
 +Call this function before creating a custom nonce so that the new nonce will be treated as an ESI block with a TTL of 12 hours. ''​$string''​ should be the same as the parameter that you pass to ''​wp_create_nonce''​.
 + 
 === LiteSpeed_Cache_API::​vary($vary_name,​ $vary_value,​ $default_value) === === LiteSpeed_Cache_API::​vary($vary_name,​ $vary_value,​ $default_value) ===
 Use this function to create a cache vary. Cache varies allow you to store multiple public versions of the same page in cache. So, if your application was for multiple currencies, you would use this function and pass it the name you have given the vary (i.e. ''​myapp_currency''​),​ the currency the current visitor is using (i.e. ''​EUR''​),​ and the default currency (i.e. ''​USD''​). [[litespeed_wiki:​cache:​developer_guide:​cache-vary | Learn more about cache varies.]] Use this function to create a cache vary. Cache varies allow you to store multiple public versions of the same page in cache. So, if your application was for multiple currencies, you would use this function and pass it the name you have given the vary (i.e. ''​myapp_currency''​),​ the currency the current visitor is using (i.e. ''​EUR''​),​ and the default currency (i.e. ''​USD''​). [[litespeed_wiki:​cache:​developer_guide:​cache-vary | Learn more about cache varies.]]
  • Admin
  • Last modified: 2020/11/14 15:31
  • by Lisa Clarke