Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Caching Help - Caching with a Twist...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Nick W
Smarty Rookie


Joined: 23 May 2003
Posts: 22

PostPosted: Mon Feb 23, 2004 9:57 am    Post subject: Caching Help - Caching with a Twist... Reply with quote

Hi all,

I am building 6 sites that will house many of the same products but display those products in differnent ways.

I'd like to avoid having seperate caches for each site and have one catch for all. BUT, the cache then needs to be output according to the individual sites style.

What ways might I approach this?

The most promising direction i've come up with is to store the cached templates as XML and then use fetch() to grab the xml and parse the xml into template varibles and assign and output them....

Anyone think of a more elegant solution?

Many thanks

Nick
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Feb 24, 2004 12:06 am    Post subject: Reply with quote

Use a unique compile_id setting for each site. Smarty will do the rest.
Back to top
View user's profile Send private message
Nick W
Smarty Rookie


Joined: 23 May 2003
Posts: 22

PostPosted: Tue Feb 24, 2004 10:26 am    Post subject: Reply with quote

Sure, but my point is that i will be storing huge amounts of similar data with just html changes between that data.

Would make more sense to store it in a generic form that all the sites can use...?

Maybe not, the time it's taking me to work this out could be better spent on ohter things... hehe!

Nick
Back to top
View user's profile Send private message
philjohn
Smarty Rookie


Joined: 26 Feb 2004
Posts: 8

PostPosted: Thu Feb 26, 2004 1:03 pm    Post subject: Disk space is cheap...cpu cycles are not... Reply with quote

...on average (unless you create really sucky bigger than necessary not enough in css files html) each of these files is going to be 10's of k's each, tops (if not you need to rethink your design, the majority of internet users are still on dialup, a painful experience when I went back to it after 4 years of 3 mbit adsl ;o)

Whats a few megs in the grand scheme of things?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Feb 26, 2004 7:58 pm    Post subject: Reply with quote

Yes, one of the rules of thumbs in computing is that lookups are cheaper (ie: faster) than calculations in general.

I suggest that your *templates* should be generic such that each site can be generated from one set of templates as your problem space appears to be collation. This eases your production burden to some degree (one set of files to maintain). As for the output of that process, you improve your overall performance when each unique site has its own files already generated (as opposed to each site being generated from template on each request) -- hence my suggestion to segregate cache/compile space by compile_id. Storage is FAR cheaper than processor and your access times will be reduced thereby increasing throughput (and hopefully meaning you will need less overall resources).
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP