All remaining vistors will get served the stale cached page until the new cached page is available. This works great if you're running a fairly low traffic site, however if your application takes let's say 2 seconds to process a given request, all traffic received to this endpoint within those 2 seconds will end up hitting the backend, and all visitors will hit PHP.īy using the stale, keyword in front the "key" you're purging, you're telling Lscache to purge the item, but if multiple visitors hit the same endpoint right after each other, only the first visitor will be the one generating the cache item. LSCache::purge('*', false) // or LSCache::purge('*', $stale=false) // or LSCache::purgeAll(false) Why stale purge matters ¶īy default the way Lscache works in LiteSpeed is by purging an element in the cache, and next request will generate the cached version. You set the cache control header for LSCache using middleware, so we can do something like this inside routes/web.php: LSCACHE_GUEST_ONLY - accepts true or false to decide if the cache should be enabled for guests only Defaults to false.LSCACHE_DEFAULT_CACHEABILITY - accepts a string, you can use values such as private, no-cache, public or no-vary Default: no-cache.LSCACHE_DEFAULT_TTL - accepts an integer, this value is in seconds Default: 0.LSCACHE_ESI_ENABLED - accepts true or false to whether you want ESI enabled or not globally Default false.You can control the config settings in your. If the default_ttl is set to 0, then the X-LiteSpeed-Cache-Control response header won't be returned. Here you can set the max-age ( default_ttl), the cacheability ( default_cacheability) such as public, private or no-cache, or enable ESI ( esi) in the X-LiteSpeed-Cache-Control response header. You'll be able to configure defaults in the config/lscache.php file. Setting the cache control headers for lscache.The package comes with 3 functionalities: LiteSpeed Memcached LiteSpeed Memcached. LSCache Developers Guide LSCache Developers Guide.LSCache Without a Plugin LSCache Without a Plugin.How to handle CSRF if you're using OpenLiteSpeed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |