The Joomla! Forum ™





Post new topic Reply to topic  [ 21 posts ] 
Author Message
PostPosted: Fri Jan 05, 2007 8:55 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
Hi,

I wrote a very basic quickstart tutorial on caching functions in 1.5. Feel free to edit it, rewrite it, publish it in the wiki, tattoo it on your forehead, or ignore it :)


EDIT: removed attachment. Read it at http://dev.joomla.org/component/option, ... g_caching/

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Last edited by mjaz on Mon Jan 08, 2007 6:52 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Jan 05, 2007 10:19 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
Hi mjaz,

Excellent work Mathias.  This is just the kind of material we need right now.  I'll get it edited, formatted and posted on the dev wiki shortly.

In the meantime a big thank you and please feel free to write some more.  :D

Regards,
Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Fri Jan 05, 2007 11:55 pm 
User avatar
Joomla! Champion
Joomla! Champion

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6568
Keep in mind that the whole caching layer is still in WIP and is slated to undergo a refactoring (it's the last major part of the architecture we still need to deal with). We hope to start on it soonish, probably end of next week.

Good work nevertheless, especialy the profiler stuff is fixed and will not change so this can be documented already.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.eu - Joomla extensions that just work
http://www.nooku.org - Extension development framework for Joomla


Last edited by Jinx on Fri Jan 05, 2007 11:57 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Jan 06, 2007 12:48 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
I needed caching for an extension i'm making. I couldn't find any docs, so I decided to document my progress as I discovered how it works. Didn't know it was still WIP. If the api changes, let us know.

btw Respect to the doc people  :-* , I never imagined writing even such a basic tut could be such hard work. I'll see if I can write some more, no promises though.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Sat Jan 06, 2007 2:32 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
mjaz wrote:
I never imagined writing even such a basic tut could be such hard work.

"What's easy reading is damned hard writing."  G. K. Chesterton (if memory serves)  :)

@Johan.  Thanks for the warning, I'd forgotten about that.  I'll post it on the dev wiki anyway, but I'll include a prominent health warning too.

Regards,
Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Sat Jan 06, 2007 4:01 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tips:using_caching/

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Sat Jan 06, 2007 5:10 pm 
User avatar
Joomla! Champion
Joomla! Champion

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6568
Thanks guys ! Good team work I call this one.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.eu - Joomla extensions that just work
http://www.nooku.org - Extension development framework for Joomla


Top
 Profile  
 
PostPosted: Thu Feb 01, 2007 9:41 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
After a quick look at the changes in svn, this should be changed in the tutorial:

1. The profiler apparently is not available by default, so all code should have:
Code:
jimport( 'joomla.utilities.profiler' );


2. cleanCache() is now clean():
Code:
$cache->clean();

instead of
Code:
$cache->cleanCache();


3. When getting a reference to the cache object, it will default to 'output', but we need 'callback', so:
Code:
// Get a reference to the global cache object.
$cache = & JFactory::getCache( 'callback' );


4. call() is a wrapper for get(), so we'll use:
Code:
$rows  = $cache->get( array( 'TestClass', 'testMethod' ), $table );



The complete code in part 5 of the tut now looks like this:
Code:
<?php
jimport( 'joomla.utilities.profiler' );

class TestClass {

    function testMethod( $table ) {

        // Get a reference to the global database object.
        $db = & JFactory::getDBO();

        // Execute the same database query 250 times.
        for( $i=0; $i<250; $i++) {
            $db->setQuery( "SELECT * FROM #__$table" );
            $rows = $db->loadObjectList();
        }

        return $rows;
    }
}

// Determine which database table to query.
$table = JRequest::getVar( 'table', 'content' );

// Get a reference to the global cache object.
$cache = & JFactory::getCache('callback' );

// Run the test without caching.
$profiler = new JProfiler();
$rows = TestClass::testMethod( $table );
echo $profiler->mark( ' without caching' );

// Run the test with caching.
$profiler = new JProfiler();
$rows  = $cache->get( array( 'TestClass', 'testMethod' ), $table );
echo $profiler->mark( ' with caching' );
?>

The other code examples should be changed as well.

I'll keep an eye out for any further changes to the svn.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Thu Feb 01, 2007 10:46 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
Hi mjaz,

Rather than update the wiki right now I think I'll wait until we can be certain that the refactoring of the cache code has been completed.  Last I heard it was still work in progress.

Thanks for the update Mathias.

Regards,
Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Thu Feb 01, 2007 11:25 pm 
User avatar
Joomla! Champion
Joomla! Champion

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6568
It still is indeed, while the code is roughly done we still need to implement it and this usualy goes with some refactoring.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.eu - Joomla extensions that just work
http://www.nooku.org - Extension development framework for Joomla


Top
 Profile  
 
PostPosted: Thu Feb 01, 2007 11:30 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
Ok. Maybe you can add backlink to this thread in the wiki.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Fri Feb 02, 2007 12:25 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
Good idea.  Done.

Regards,
Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Fri Jun 01, 2007 9:25 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Nov 08, 2005 6:43 pm
Posts: 225
Location: the Netherlands
Jinx wrote:
It still is indeed, while the code is roughly done we still need to implement it and this usualy goes with some refactoring.


Jinx,

What is the status of the code regarding to caching? I'm exploring the possibilities for my component.

I'm facing several issues like: pathway building problems, registration of 'hits', JToolbarHelper doesn't get called in the backend, etc. etc. Are these issues to be solved, or is it simply not covered by the cache layer?

Thanks in advance,
Mark


Last edited by markuz on Fri Jun 22, 2007 11:06 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Jun 06, 2007 10:27 pm 
Joomla! Intern
Joomla! Intern

Joined: Mon Sep 12, 2005 7:54 am
Posts: 71
I'm with Markuz, before I go digging around too much with this, does the article stand correct, or is the cache completely refactored and invalidates this article?

Todd


Top
 Profile  
 
PostPosted: Fri Jun 22, 2007 9:34 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Aug 24, 2005 9:34 am
Posts: 726
Location: Rørvik, Norway
Same question. :)

_________________
Torkil Johnsen
http://torkiljohnsen.com
http://twitter.com/torkilj


Top
 Profile  
 
PostPosted: Fri Jul 06, 2007 11:45 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Aug 24, 2005 9:34 am
Posts: 726
Location: Rørvik, Norway
I forgot to say that I got a response to this: The cache code is done. :)

_________________
Torkil Johnsen
http://torkiljohnsen.com
http://twitter.com/torkilj


Top
 Profile  
 
PostPosted: Fri Jul 06, 2007 2:40 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Nov 08, 2005 6:43 pm
Posts: 225
Location: the Netherlands
Thanks Torkil,

Still have the following issues though...
markuz wrote:
I'm facing several issues like: pathway building problems, registration of 'hits', JToolbarHelper doesn't get called in the backend, etc. etc. Are these issues to be solved, or is it simply not covered by the cache layer?

Mark


Top
 Profile  
 
PostPosted: Sun Aug 12, 2007 4:48 am 
Joomla! Champion
Joomla! Champion

Joined: Wed Nov 22, 2006 3:35 pm
Posts: 6927
Location: Nebraska
The wiki points to this thread - and this thread points to the wiki - as the most current documentation. Following is from the wiki.

Quote:
Warning: The Joomla! 1.5 cache API is currently being refactored and you should not rely on the information contained in this tutorial remaining true. Further information may be found in this forum thread.


It appears the wiki is up to date, now. Should the wiki warning now be removed?

Thanks!
Amy :)

_________________
http://Twitter.com/AmyStephen
http://www.alltogetherasawhole.org/


Top
 Profile  
 
PostPosted: Thu Aug 16, 2007 12:17 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
Wiki warning has been removed.

Thanks for the reminder Amy.

Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
PostPosted: Sun Jun 14, 2009 3:51 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Tue Aug 30, 2005 9:18 am
Posts: 559
Location: Denmark
The wiki link does not work anymore.... :(

_________________
http://www.toolmaster.dk - Danish Joomla Services!


Top
 Profile  
 
PostPosted: Sun Jun 14, 2009 6:08 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 8:57 am
Posts: 1377
Location: Shrewsbury, Shropshire, United Kingdom
It's been moved to the "new" wiki: http://docs.joomla.org/Using_caching_to ... _your_code

Regards,
Chris.

_________________
Chris Davenport - Joomla Production Leadership Team

Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ] 



Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group