Drupal 8 Cache contexts | Drupal 8

Drupal 8 Cache contexts

Submitted by editor on Mon, 04/24/2017 - 13:00
Question

How to use drupal 8 cache contexts ?

Drupal 8 shiped with a powerfull cache API able to set cache according to a context. correct usage of this cache improve the site preformence greatly.

https://www.drupal.org/docs/8/api/cache-api/cache-contexts
https://www.drupal.org/node/2451661

Cache contexts

cookies:NAME
headers:NAME
ip
languages:TYPE
request_format
route.book_navigation
route.menu_active_trails:MENU_NAME
route.name
session.exists
theme
timezone
url.path.is_front
url.path.parent
url.query_args:KEY
url.query_args.pagers:PAGER_ID
url.site
user.is_super_user
user.node_grants:OPERATIONS
user.permissions
user.roles:ROLE

 

Example 1 - URL :

$output['#cache']['max-age'] = 3600; // 3600 = 1h
$output['#cache']['contexts'] = ['url'];

 

 

Comments

keltan (not verified)

Thu, 05/11/2017 - 12:39

I'm very inspired with this weblog. this indicates it literally does not have any dietary cost and consuming it virtually makes your body use up stored nutrients to method it. last time I visit write my essay this website also awesome Honey then again has many useful nutrients, enzymes, and antioxidants; uncooked honey is first-class as standard honey processing

 

 

changhon62 (not verified)

Fri, 09/28/2018 - 02:47

In reply to by keltan (not verified)

mcm bags
lacoste sale
skechers
jordan shoes
yeezy shoes
burberry purses
longchamp le pliage
ralph lauren polo shirts
air max
under armour
fitflop sandals
kyire 4
yeezy boost 350
mk handbags
air max 90
adidas
jordan retro 11
salvatore ferragamo
true religion jeans for women
goyard tote
ray ban prescription sunglasses
new balance
barbour
pandora necklace
salomon xa pro 3d
ugg
birkenstock outlet
ferragamo shoes men
skechers women
mulberry handbags
ray ban
coach
longchamp handbag
birkenstock sale
adidas originals nmd
mont blanc sale
Hermes Handbags
burberry handbags
yeezy boost 350 v2
pandora
red bottoms
asics
air max 270
moncler jacket mens
pandora
nike air max 90
ray ban wayfarer
jordan retro 11
kd 9
nike air max 270
salomon shoes
adidas originals ultra boost
moncler,moncler jacket
nike air max 90
kate spade handbags
moncler sale
moncler
nike lebron
huarache shoes
asics
air max 90
Pandora Charms
nike air max
burberry wallet
nike air max 95 mens
nike air max 90
air max 95 mens
mbt womens shoes
Yeezy Shoes
supreme jacket
mcm bags
yeezy boost
ugg
skechers outlet
Salomon
pandora jewelry
red bottoms
mulberry bayswater
womens north face jacket
cheap oakley sunglasses
off white nike
curry shoes
red bottoms
ed hardy shirt
north face outlet
adidas originals ultra boost
jordan 11
nike air max 95
polo ralph lauren outlet
puma shoes
valentino
vapormax
swarovski bracelet
air max 97
ugg boots
goyard tote
supreme clothing
lebron 14
swarovski pen
prada
moncler jacket mens
oakley sunglasses
pandora rings
nike air max 97
pandora,pandora charms
coach handbags
chrome hearts
adidas originals nmd
jordan shoes
barbour outlet
pandora bracelet
under armour stephen curry
fitflop sandals
kyrie irving shoes
salomon xa pro 3d
nike air max 90
michael kors bags
fitflop
kd 10
adidas nmd r1
fitflops clearance
jimmy choo heels
pandora Charms
ecco sandals
air max 97 silver bullet
ralph lauren shirts
cartier bracelet
pandora rings
nike air max 90
hermes belt women
chrome hearts necklace
bvlgari handbags
yeezy boost
ugg,ugg slippers
balenciaga shoes men
true religion
harden vol 2
chrome hearts jewelry
adidas superstar
kate spade outlet
pandora
red bottom shoes
adidas originals nmd
nike kd
pandora
moncler
kate spade bags
celine purse
jordan shoes
air max
prada handbags
polo
yeezy boost 350
yeezy shoes
balenciaga bags
huaraches
ray ban
nike vapor max

Add new comment