I thought I’d share a quick and simple method to improving loading times when extracting JSON data from an API within a Magento build.
For one particular client, this improved loading times considerably and in some cases by over two seconds.
$cache_key = 'json_feed_name';
$cache_tag = 'homepage';
if ( false !== ($list = Mage::app()->getCache()->load($cache_key)) ) {
$list = unserialize($list);
} else {
$json = file_get_contents($_SERVER['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_HOST'].'/api/?json=get_content_feed');
$list = json_decode($json);
Mage::app()->getCache()->save(serialize($list), $cache_key, array($cache_tag), 3600*6);
}
Please note, I’ve used $_SERVER['HTTP_X_FORWARDED_PROTO']
to get the protocol used by CloudFlare as the service we’re contacting uses their service.
Webmentions
amoxicillin dose
amoxicillin dose
lisinopril recall 2022
lisinopril recall 2022
flagyl for diarrhea
flagyl for diarrhea
what is doxycycline
what is doxycycline
does ampicillin dissolve in water
does ampicillin dissolve in water
is keflex a broad spectrum antibiotic
is keflex a broad spectrum antibiotic
c-tadalafil
c-tadalafil
generic female viagra in india
generic female viagra in india
cost of ivermectin 3mg tablets
cost of ivermectin 3mg tablets
buy cheap vardenafil
buy cheap vardenafil
stromectol drug
stromectol drug
viagra where to buy canada
viagra where to buy canada
tadalafil pills online
tadalafil pills online
cheap vardenafil tablets
cheap vardenafil tablets
how many mg of sildenafil should i take
how many mg of sildenafil should i take
erectalis tadalafil
erectalis tadalafil
vietnam pharmacy valium
vietnam pharmacy valium
vardenafil (levitra)
vardenafil (levitra)
is 60 mg of sildenafil too much
is 60 mg of sildenafil too much
buy oral ivermectin
buy oral ivermectin
abilify shot vs pill
abilify shot vs pill
what class of drug is tizanidine
what class of drug is tizanidine
actos users
actos users
voltaren gel coupon walmart
voltaren gel coupon walmart
tamsulosin recreational use
tamsulosin recreational use
ezetimibe simvastatin vytorin
ezetimibe simvastatin vytorin
semaglutide uk
semaglutide uk
amitriptyline overdose
amitriptyline overdose
repaglinide sustained release tablets
repaglinide sustained release tablets
augmentin 875-125
augmentin 875-125
does celebrex work
does celebrex work
bupropion long term side effects
bupropion long term side effects
celecoxib classification
celecoxib classification
how long does it take for baclofen to work
how long does it take for baclofen to work
what is aripiprazole used for
what is aripiprazole used for
effexor sexual side effects
effexor sexual side effects
hormonio ddavp
hormonio ddavp
cozaar price at walmart
cozaar price at walmart
citalopram dosage 10 mg
citalopram dosage 10 mg
does flexeril show up on drug tests
does flexeril show up on drug tests
whats cephalexin used for
whats cephalexin used for
what is the half life of cymbalta
what is the half life of cymbalta
can you take amoxicillin with ibuprofen
can you take amoxicillin with ibuprofen
escitalopram coupon tennessee
escitalopram coupon tennessee
duloxetine 20mg capsules
duloxetine 20mg capsules
keflex while breastfeeding
keflex while breastfeeding
pdr metronidazole
pdr metronidazole
rybelsus commercial
rybelsus commercial
rybelsus titration
rybelsus titration
semaglutide 4 week results
semaglutide 4 week results
lasix 3169
lasix 3169
lisinopril schuppenflechte
lisinopril schuppenflechte
einnahmeschema metformin
einnahmeschema metformin
valacyclovir creatinine
valacyclovir creatinine
does lyrica thin your blood
does lyrica thin your blood
sulfamethoxazole tmp sleep aids
sulfamethoxazole tmp sleep aids
metronidazole flagystatin
metronidazole flagystatin
neurontin odpłatność
neurontin odpłatność
cialis dosage 20mg
cialis dosage 20mg
cialis for daily use
cialis for daily use
buy online viagra in usa
buy online viagra in usa
how to order vigra on internet
how to order vigra on internet
vancouver pharmacy viagra
vancouver pharmacy viagra
buy tadalafil online no prescription
buy tadalafil online no prescription
albany college of pharmacy
albany college of pharmacy
buy tadalafil cheap
buy tadalafil cheap
blood pressure on cialis
blood pressure on cialis