Skip to content

Commit

Permalink
Updated README, package.xml (not finished)
Browse files Browse the repository at this point in the history
  • Loading branch information
fruit committed Jun 27, 2010
1 parent 9151c25 commit 2be4e69
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
24 changes: 18 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ are not (atomic counter).

* ### Native use

* not recommended - use Doctrine_Cache_* to store Doctrine_Record and Doctrine_Collection objects
* use Doctrine_Cache_* to store Doctrine_Record and Doctrine_Collection objects

[php]
# Somewhere in the frontend, you need to print out latest posts
Expand All @@ -264,7 +264,7 @@ are not (atomic counter).
$tagger = $this->getContext()->getViewCacheManager();

# write data to the cache ($posts is instance of the Doctrine_Collection_Cachetaggable)
$tagger->set('my_posts', $posts, 60 * 60 * 24 * 30/* 1 month */, $posts->getTags());
$tagger->set('my_posts', $posts->toArray(), 60 * 60 * 24 * 30/* 1 month */, $posts->getTags());

# fetch latest post to edit it
$post = $posts->getFirst();
Expand All @@ -284,11 +284,11 @@ are not (atomic counter).
# $post object was updated, so, all $posts in cache "my_posts” is invalidated automatically)
if ($data = $tagger->get('my_posts'))
{
# this block will not be executed
# this block never executed
}

# save new data to the cache
$tagger->set('my_posts', $posts, null, $posts->getTags());
$tagger->set('my_posts', $posts->toArray(), null, $posts->getTags());

# will return data (objects are fresh)
if ($data = $tagger->get('my_posts'))
Expand All @@ -313,7 +313,7 @@ are not (atomic counter).
->limit(3)
->execute();

$tagger->set('my_posts', $posts, null, $posts->getTags());
$tagger->set('my_posts', $posts->toArray(), null, $posts->getTags());

# will return data
if ($data = $tagger->get('my_posts'))
Expand Down Expand Up @@ -396,8 +396,12 @@ are not (atomic counter).
->limit(3)
->execute();


# See more about all available methods in PHPDOC of file
# ./plugins/sfCacheTaggingPlugin/lib/util/sfViewCacheTagManagerBridge.class.php
$this->setUserTags($posts->getTags());
# or equivalent

# or equivalent-shorter code
# $this->setUserTags($posts);

$this->posts = $posts;
Expand Down Expand Up @@ -447,6 +451,8 @@ are not (atomic counter).
}

# after, we pass all tags to cache manager
# See more about all available methods in PHPDOC of file
# ./plugins/sfCacheTaggingPlugin/lib/util/sfViewCacheTagManagerBridge.class.php
$this->setUserTags($posts->getTags());

# or shorter
Expand All @@ -471,12 +477,16 @@ are not (atomic counter).
$this->car = Doctrine_Core::getTable('car')->find($request->getParameter('id'));

# set the tags for the action cache
# See more about all available methods in PHPDOC of file
# ./plugins/sfCacheTaggingPlugin/lib/util/sfViewCacheTagManagerBridge.class.php
$this->setPageTags($this->car->getTags());

# or shorter
# $this->setPageTags($this->car);
}
}

~/plugins/sfCacheTaggingPlugin/lib/util/sfViewCacheTagManagerBridge.class.php

* Of cause you have to enable the cache for that action in ``config/cache.yml``:

Expand All @@ -501,6 +511,8 @@ are not (atomic counter).
$this->car = Doctrine_Core::getTable('car')->find($request->getParameter('id'));

# set the tags for the action cache
# See more about all available methods in PHPDOC of file
# ./plugins/sfCacheTaggingPlugin/lib/util/sfViewCacheTagManagerBridge.class.php
$this->setActionTags($this->car->getTags());

# or shorter
Expand Down
23 changes: 16 additions & 7 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
<email>fruit.dev@gmail.com</email>
<active>yes</active>
</lead>
<date>2010-06-09</date>
<date>2010-06-27</date>
<version>
<release>1.4.4</release>
<api>1.1.1</api>
<release>1.5.0</release>
<api>2.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.symfony-project.com/license">MIT</license>
<notes>
* ilya: [fixed] resolved conflict with SoftDelete build-in Doctrine behavior
* ilya: [fixed] by saving not modified object, version was updated
* ilya: [added] new unit/functional tests

</notes>
<contents>
<dir name="/">
Expand All @@ -43,8 +41,8 @@
<file name="sfFileTaggingCache.class.php" role="data" />
<file name="sfSQLiteTaggingCache.class.php" role="data" />
</dir>
<file name="sfContentTagHandler.class.php" role="data" />
<file name="sfTaggingCache.class.php" role="data" />
<file name="sfViewCacheTagManager.class.php" role="data" />
</dir>
<dir name="doctrine">
<dir name="collection">
Expand All @@ -63,9 +61,13 @@
</dir>
<dir name="util">
<file name="sfCacheTaggingToolkit.class.php" role="data" />
<file name="sfCallableArray.class.php" role="data" />
<file name="sfTagNamespacedParameterHolder.class.php" role="data" />
<file name="sfViewCacheTagManagerBridge.class.php" role="data" />
</dir>
<dir name="view">
<file name="sfPartialTagView.class.php" role="data" />
<file name="sfViewCacheTagManager.class.php" role="data" />
</dir>
</dir>
<dir name="test">
Expand All @@ -87,16 +89,23 @@
<file name="actionWithoutLayoutTest.php" role="data" />
<file name="sfCacheTaggingPluginTest.php" role="data" />
<file name="sfCacheTaggingToolkitTest.php" role="data" />
<file name="sfContentTagHandlerTest.php" role="data" />
<file name="sfTaggingCacheTest.php" role="data" />
<file name="sfViewCacheTagManagerBridgeTest.php" role="data" />
<file name="sfViewCacheTagManagerTest.php" role="data" />
</dir>
<dir name="notag">
<file name="DoctrineListenerCachetaggableTest.php" role="data" />
<file name="sfCacheTaggingToolkitTest.php" role="data" />
</dir>
</dir>
<dir name="unit">
<file name="DoctrineListenerCachetaggableTest.php" role="data" />
<file name="DoctrineTemplateCachetaggableTest.php" role="data" />
<file name="sfCacheTaggingToolkitTest.php" role="data" />
<file name="sfCallableArrayTest.php" role="data" />
<file name="sfCallableArrayTest.php" role="data" />
<file name="sfContentTagHandlerTest.php" role="data" />
</dir>
</dir>
</dir>
Expand Down

0 comments on commit 2be4e69

Please sign in to comment.