1 of 2
1
Plugin: Cacher   //  Caches stuff to retrieve later.
Posted: 25 July 2008 08:17 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007

Cacher allows you to move one or more pieces of content from one spot in your template to another. How is that handy? Well, have you ever had to use the same module tags twice (or more) on one page because there was no other way to place the content in all the places you wanted it?

That can be extremely wasteful, meaning your server has to work harder and your users have to wait longer to see the page. Cacher’s ability to place your content wherever you want it helps get rid of that problem.

Features:
* Move/copy chunk of content around in your template, without re-using tags.
* Move/copy them across templates.
* “Group” stuff and move/copy them around across templates or in the same template.


Download and View the documentation on my website

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 25 July 2008 09:39 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6554
Joined  04-15-2006

Hi Victor,

Looks interesting. Just wondering if you had any possible demonstrations of where this would come in handy?

As far as I know isn’t the $SESS cache just use-able for the page you are currently viewing? If so then it’s not like a true session variable is it?

Just trying to get my head around uses for this one as I like what you write! wink

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 25 July 2008 10:28 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007
Mark Bowen - 25 July 2008 09:39 AM

Hi Victor,

Looks interesting. Just wondering if you had any possible demonstrations of where this would come in handy?

As far as I know isn’t the $SESS cache just use-able for the page you are currently viewing? If so then it’s not like a true session variable is it?

Just trying to get my head around uses for this one as I like what you write! wink

Best wishes,

Mark


Quick example:

// This tag will be replaced by the title
<title>{cacher:entry_title} | Some blurb</title>


--
Some more code --


{exp:weblog:entries weblog="bla"}

// Lets put the entry title inside of the cache.
{exp:cacher:put key="entry_title" text="{title}"}

## Some code ##

// Fetch the title and display it here AND replace the {cacher:} tag above.
<h1>{exp:cacher:get key="entry_title" this_template="yes" here="yes"}</h1>



## More code ###



{/exp:weblog:entries}

Normall you will need 2 {exp:weblog:entries} call to have the entry title show up in the page title and somewhere else on the page. (or wrap your whole template with exp;weblog:entries, not possible under some situations)

What i do here is fetch the title, and make it display on 2 places with only 1 exp:weblog:entries call.

And yes $SESS->cache is only for the current pageview.

If you need some more examples.. i know a few more,
used this plugin countless time and speeds up some stuff up.

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 25 July 2008 10:37 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  98
Joined  03-10-2005

Victor very cool

 Signature 

David Rencher
lumis.com
Image Sizer
eeFlickr
Photos

Profile
 
 
Posted: 25 July 2008 11:03 AM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6554
Joined  04-15-2006
Victor Gutierrez - 25 July 2008 10:28 AM

Normally you will need 2 {exp:weblog:entries} call to have the entry title show up in the page title and somewhere else on the page. (or wrap your whole template with exp;weblog:entries, not possible under some situations)

What i do here is fetch the title, and make it display on 2 places with only 1 exp:weblog:entries call.

Aha I get it now!! wink

Sounds pretty useful. Just wondering though does this make the system any noticeably faster than rather having the two weblog tags? Just wondering what the overall speed increase would be?

Thanks for the explanation by the way.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 25 July 2008 11:38 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007
Mark Bowen - 25 July 2008 11:03 AM
Victor Gutierrez - 25 July 2008 10:28 AM

Normally you will need 2 {exp:weblog:entries} call to have the entry title show up in the page title and somewhere else on the page. (or wrap your whole template with exp;weblog:entries, not possible under some situations)

What i do here is fetch the title, and make it display on 2 places with only 1 exp:weblog:entries call.

Aha I get it now!! wink

Sounds pretty useful. Just wondering though does this make the system any noticeably faster than rather having the two weblog tags? Just wondering what the overall speed increase would be?

Thanks for the explanation by the way.

Best wishes,

Mark

The {exp:weblog:entries} tag is the heaviest tag of them all.
Just calling it can produce 5 to 30 extra queries.

So on heavy pageviewed websites the {exp:weblog:entries} is a resource hog when used multiple times.
Sure that caching helps a bit…But in some situations..you cannot cache the whole page.

So limiting the use of {exp:weblog:entries} is a big winner for me raspberry

Of course this plugin works with all kind of tags.


Another example

## Some CODE ##

{exp:weblog:entries weblog="bla" entry_id="2"}

// Store the gallery category id (custom field)
{exp:cacher:put type="gallery_cat_id" text="{gallery_cat}"}

{
/exp:weblog:entries}

## LOTS of code ###

{exp:gallery:entries category_id="{exp:cacher:get type="gallery_cat_id"}" parse="inward"}


//Don't want to use parse="inward"?

{exp:cacher:get type="gallery_cat_id" this_template="yes"}
{exp
:gallery:entries category_id="{cacher:gallery_cat_id}" parse="inward"}

// I could even put that exp:cacher:get tag somewhere else before the exp:gallery:entries

## MORE CODE ###

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 25 July 2008 01:53 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  276
Joined  06-12-2002

What’s the difference between this and rEEposition?

Profile
 
 
Posted: 25 July 2008 02:09 PM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007
alienne - 25 July 2008 01:53 PM

What’s the difference between this and rEEposition?

Let me try to explain:
All the stuff that reeposition does must be inside it’s tag {exp:reeposition}
So you need to wrap your content with it.

Cacher doesn’t have this limitation, it can parse stuff before it’s own tag.
And it can parse stuff in a parent template. (if the tag resides in an embedded template).

Reeposition also uses REGEX to fetch it’s data. Which is heavy.

Those are the main differences.

I can think of numerous situations Cacher is a better solution.
Of course reeposition has it own features too.

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 25 July 2008 05:27 PM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1076
Joined  01-24-2006

Nice one… I can see how this would be handy smile

 Signature 

VOTE FOR LG Addons in the Mashable Open Web Awards!


Newism - Newcastle Web Design & Development


LG Better Meta now w/ Sitemap Meta & XML Generator | LG Polls | LG .htaccess Generator

Profile
 
 
Posted: 14 August 2008 06:41 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

Victor, does your plugin have a similar feature to rEEposition’s “group” parameter?

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 27 September 2008 10:27 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007

Released version 1.5.0

- Added “grouping” content functionality (request by smallbeer)

Download and View the documentation on my website

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 02 October 2008 03:40 AM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  26
Joined  12-16-2007

Hi Victor,

Is it possible to use Cacher in conjunction with EntryData?

Profile
 
 
Posted: 02 October 2008 06:17 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007

Depending on how you want to use it.

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 02 October 2008 06:32 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  26
Joined  12-16-2007

Well, something like

{exp:cacher:put type="test_variable" text="{exp:entrydata:info url_title='{segment_1}' section='title' field_format='xhtml'}"}


I tried this already, but doesn’t seems to work.

Profile
 
 
Posted: 02 October 2008 06:56 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007
Nico Smit - 02 October 2008 06:32 AM

Well, something like

{exp:cacher:put type="test_variable" text="{exp:entrydata:info url_title='{segment_1}' section='title' field_format='xhtml'}"}


I tried this already, but doesn’t seems to work.

The parse=“inward” parameter is needed.

{exp:cacher:put type="test_variable" text="{exp:entrydata:info url_title='{segment_1}' section='title' field_format='xhtml'}" parse="inward"}

Or you can always use the variable pair.

{exp:cacher:put type="test_variable"}
{exp
:entrydata:info url_title='{segment_1}' section='title' field_format='xhtml'}
{
/exp:cacher:put}

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 02 October 2008 11:45 AM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  34
Joined  07-24-2003

Hi Victor,

I downloaded and installed cacher And I tried to follow your example but I can’t for the life of me get this to work.

This is ny code.

{exp:weblog:entries weblog="{current_blog}" orderby="date" limit="1" status="draft"}

{exp
:cacher:put key="my_cache" text="{title}"}

{
/exp:weblog:entries}

<p>{exp:cacher:get key="my_cache" this_template="yes" here="yes"}</p>

any help would be great.

Profile
 
 
Posted: 02 October 2008 11:56 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  716
Joined  07-02-2007
dchrist - 02 October 2008 11:45 AM

Hi Victor,

I downloaded and installed cacher And I tried to follow your example but I can’t for the life of me get this to work.

This is ny code.

{exp:weblog:entries weblog="{current_blog}" orderby="date" limit="1" status="draft"}

{exp
:cacher:put key="my_cache" text="{title}"}

{
/exp:weblog:entries}

<p>{exp:cacher:get key="my_cache" this_template="yes" here="yes"}</p>

any help would be great.

Yes this is a parsing order issue, EE loves to this kind of stuff.
Try this:


{exp:weblog:entries weblog="{current_blog}" orderby="date" limit="1" status="draft"}

{exp
:cacher:get key="my_cache" this_template="yes" text="{title}"}

{
/exp:weblog:entries}

<p>{cacher:my_cacher}</p>

As you can see there is a hidden feature in the GET function, you can put the text while getting.

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 02 October 2008 12:05 PM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  34
Joined  07-24-2003

Thanks,

Worked like a charm.

Profile
 
 
Posted: 28 October 2008 11:44 AM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  285
Joined  02-02-2007

Hi Victor,

It is not clear to me how content can be moved across templates. Should those templates be in parent-child relationship?

I have two templates: embedded template technical/embed and parent template technical/for_tests4. I need to move some stuff from embedded template into parent template.

I tried this code in parent template technical/for_tests4

{embed="technical/embed"}
{exp
:cacher:get key="some_key"}

and in embed template technical/embed this code

{exp:cacher:put key="some_key"}
Alot of text
, lots lots lots.
Like an entry
{
/exp:cacher:put}

But this code did not output anything.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64935 Total Logged-in Users: 54
Total Topics: 81903 Total Anonymous Users: 24
Total Replies: 440280 Total Guests: 259
Total Posts: 522183    
Members ( View Memberlist )