473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Content management and caching

Hi

I use PEAR Cache to cache the frontend pages of a content managed web site.
Now I update the contents of a page, and of course the updated contents will
only be displayed after the expiring period of the cached file.

After thinking and googling a lot I see several possible approaches to for
handling this, each of which has it's downsides:

- Use a very short expiring period. (Downside: Makes caching only relevant
at very high visitor frequencies.)

- Change database, add modification date to every record - and compare
creation date of cache files with modification dates of contents. (Huge
overhead; must first detect which tables and records the page uses at all.)

- Flush cache everytime an admin page is called, or within the insert,
update, publish etc functions. (Empties whole cache also if only a comma is
changed.)

- Provide an "flush cache" button for the administrator to use after
finishing changes. (Administrator will forget it.)

I would appreciate any better ideas or comments, thank you.

--
Markus
Jul 17 '05 #1
9 1533
Hello,

On 10/14/2004 02:20 PM, Markus Ernst wrote:
I use PEAR Cache to cache the frontend pages of a content managed web site.
Now I update the contents of a page, and of course the updated contents will
only be displayed after the expiring period of the cached file.

After thinking and googling a lot I see several possible approaches to for
handling this, each of which has it's downsides:

- Use a very short expiring period. (Downside: Makes caching only relevant
at very high visitor frequencies.)

- Change database, add modification date to every record - and compare
creation date of cache files with modification dates of contents. (Huge
overhead; must first detect which tables and records the page uses at all.)

- Flush cache everytime an admin page is called, or within the insert,
update, publish etc functions. (Empties whole cache also if only a comma is
changed.)

- Provide an "flush cache" button for the administrator to use after
finishing changes. (Administrator will forget it.)

I would appreciate any better ideas or comments, thank you.


You may want to try this other generic cache class that stores arbitrary
cache data in files. It comes with a function that lets you invalidate a
specific cache file forcing the content to be regenerated next time the
cache is used.

I use this precisely for the same reasons as your in a site where over
10.000 content blocks are cache in files taking over 150MB . Some of the
cache files expire after a certain amount of time but in some cases I
need to force certain cache files to be regenerated due to some event
that could not be antecipated when it would happen.

This solution works wonders not only for that purpose but also because
it uses safe locking which is very important to prevent cache corruption
in a busy site like I have when many simultaneous user accesses attempt
to verify and update the same cache files.

http://www.phpclasses.org/filecache
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #2
Markus Ernst wrote:
I use PEAR Cache to cache the frontend pages of a content managed web site.
Now I update the contents of a page, and of course the updated contents will
only be displayed after the expiring period of the cached file.

After thinking and googling a lot I see several possible approaches to for
handling this, each of which has it's downsides:

- Use a very short expiring period. (Downside: Makes caching only relevant
at very high visitor frequencies.)

- Change database, add modification date to every record - and compare
creation date of cache files with modification dates of contents. (Huge
overhead; must first detect which tables and records the page uses at all.)

- Flush cache everytime an admin page is called, or within the insert,
update, publish etc functions. (Empties whole cache also if only a comma is
changed.)

- Provide an "flush cache" button for the administrator to use after
finishing changes. (Administrator will forget it.)

I would appreciate any better ideas or comments, thank you.


Turck MMCache (http://turck-mmcache.sourceforge.net/) - haven't done a
lot with it yet, but it seems to be reducing overhead a bunch on my CMS,
and I haven't noticed out-of-date content being served...

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #3
Justin Koivisto wrote:
Turck MMCache (http://turck-mmcache.sourceforge.net/) - haven't done a
lot with it yet, but it seems to be reducing overhead a bunch on my
CMS, and I haven't noticed out-of-date content being served...


That looks nice, thank you, but I am on shared hosting, so I can't change my
server configuration.

--
Markus
Jul 17 '05 #4
Markus Ernst wrote:
Justin Koivisto wrote:

Turck MMCache (http://turck-mmcache.sourceforge.net/) - haven't done a
lot with it yet, but it seems to be reducing overhead a bunch on my
CMS, and I haven't noticed out-of-date content being served...

That looks nice, thank you, but I am on shared hosting, so I can't change my
server configuration.


I know the feeling... I will be convincing an ISP or two in the area to
support it. The install only takes like 5-10 minutes on the server side.

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #5
Hi Markus,

Markus Ernst wrote:
- Change database, add modification date to every record - and compare
creation date of cache files with modification dates of contents. (Huge
overhead; must first detect which tables and records the page uses at all.)


Not necessarily. One could do what in A.I. is called 'truth maintenance'
on the database: If you pass all queries that are executed through a
single funcion, the funcion can pass them to a parser and the parse tree
to a cache maintenance function, records can be created that relate the
elements of each select statement to the page. Then when an update or
insert statement comes across, the parse tree from the update can be
used to search those records for query elements whose funcion might be
affected by the update, insert or delete. If properly combined into
logical conditions the affected pages can be identified quite efficiently.
For example an update the record in the 'menu' table with 'id' = 12,
might require a query for pages that perform a select on the 'menu'
table with conditions that inlcude 'id' and are true for id = 12.

Of course the parsing of queries if a page is not in the cache, and
querying for affected pages only on inserts, updates and deletes. Cache
performance itself will not be affected.

I admit programming this is complex, but once it is done it will be
simple to reuse the program to get a list of the urls of the pages that
need to be flushed from the cache. Or maybe it could be in the database
itself: simply pass the database the url of your page with each select
statement and it will be able to give you all affected urls after each
transaction. I guess it should not be hard to find a univeristy
informatics student that wants to work this out into a working
prototype, if that has not already been done. I wonder if oracle, ibm or
so is already working on this.

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

Jul 17 '05 #6
Justin Koivisto <sp**@koivi.com> wrote in message news:<Lp*****************@news7.onvoy.net>...
<snip>
Turck MMCache (http://turck-mmcache.sourceforge.net/) - haven't done a
lot with it yet, but it seems to be reducing overhead a bunch on my CMS,
and I haven't noticed out-of-date content being served...


Sorry, but may I know your PHP version? This confirms issues in
production servers <http://sourceforge.net/tracker/?group_id=69426&atid=524487>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #7
R. Rajesh Jeba Anbiah wrote:
Justin Koivisto <sp**@koivi.com> wrote in message news:<Lp*****************@news7.onvoy.net>...
<snip>
Turck MMCache (http://turck-mmcache.sourceforge.net/) - haven't done a
lot with it yet, but it seems to be reducing overhead a bunch on my CMS,
and I haven't noticed out-of-date content being served...

Sorry, but may I know your PHP version? This confirms issues in
production servers <http://sourceforge.net/tracker/?group_id=69426&atid=524487>


4.3.8

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #8
Justin Koivisto <sp**@koivi.com> wrote in message news:<XW*************@news7.onvoy.net>...
<snip>
Sorry, but may I know your PHP version? This confirms issues in
production servers <http://sourceforge.net/tracker/?group_id=69426&atid=524487>


4.3.8


Thanks:)

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #9
R. Rajesh Jeba Anbiah wrote:
Justin Koivisto <sp**@koivi.com> wrote in message news:<XW*************@news7.onvoy.net>...
<snip>
Sorry, but may I know your PHP version? This confirms issues in
production servers <http://sourceforge.net/tracker/?group_id=69426&atid=524487>


4.3.8


Thanks:)


Something that I'm not seeing there?

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Scott | last post by:
Hi, Can I ask some advice in regards database solutions and content management solutions.? Do you have a philosophy on what is the best for databases - ASP, JSP, Cold fusion, PHP, etc. My...
12
by: jonathan.beckett | last post by:
Hi All, For the past few months I have been working on an open source Apache/PHP/MySQL content management system - and have recently made it available for download. It's still very much a...
0
by: jonathan.beckett | last post by:
Hi All, I have just made version 0.4.8 of the PluggedOut CMS Content Management System available for download - it's free, and covered by the GPL. It's still very much a work in progress...
0
by: Scott Abel | last post by:
For immediate release: The Rockley Group Content Management Workshop Series Coming to Atlanta, Seattle, Vancouver, Chicago, Washington, DC, Toronto, and Research Triangle Park Learn more:...
1
by: Epetruk | last post by:
Hello all, I'm sorry for the long post, but I think it's better if I'm as detailed as I can be so that I don't make a mistake in my choice and so that there's a clear understanding of to what...
0
by: Jobs | last post by:
All answers to the below interview questions are at http://www.geocities.com/dotnetinterviews/ or you can download the complete answer zip file from...
3
by: Andrew Robinson | last post by:
Can anyone point me in the direction of a reasonable content management package that plays nicely with ASP.NET? We have a couple of corporate sites that have about 100 pages and looking for a way...
0
by: Scott Abel | last post by:
Tuesday, December 12, 2006 -- 10:00AM EST / 3:00 PM GMT X-Pubs presents: CMS & Change - Love it, Hate it, Master it (Scott Abel & Emma Hamer) Reserve your Webinar seat now at:...
5
by: clintonG | last post by:
No e-commerce is required. The prospective client is asking for "content management" e.g.managing photos and product descriptions and so on. During a brief telephone interview I learned the client...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.