CppCMS
Public Member Functions | Friends | List of all members
cppcms::triggers_recorder Class Reference

triggers_recorder is a class that allows you to record all triggers added in certain scope. More...

#include <cppcms/cache_interface.h>

Inheritance diagram for cppcms::triggers_recorder:
booster::noncopyable

Public Member Functions

 triggers_recorder (cache_interface &)
 
 ~triggers_recorder ()
 
std::set< std::string > detach ()
 

Friends

class cache_interface
 

Detailed Description

triggers_recorder is a class that allows you to record all triggers added in certain scope.

It is useful to have have "sub-dependencies" for smaller parts.

For example:

if(cache().fetch_page("news"))
return;
// something there
if(cache().fetch_frame("politics",text))
response().out() << text;
else {
copy_filter politics(respone().out());
triggers_recorder politics_triggers(cache());
// some thing else there
for(int i=0;i<articles.size();i++) {
if(cache().fetch_frame(article_tag,text);
response().out() << text;
else {
copy_filter article(respone().out());
// generate article
cache().store_frame(article_tag,article.detach());
}
}
cache().store_frame("polotics",
politics.detach(), // the recorded content of politics
politics_triggers.detach());
}
...

So tag "politics" records all added triggers like "article_234" and now rise of "article_234" would invalidate "politics" section as well as we automatically record all triggers inserted in triggers_recorder scope.

Constructor & Destructor Documentation

cppcms::triggers_recorder::triggers_recorder ( cache_interface )

Start recording all triggers

cppcms::triggers_recorder::~triggers_recorder ( )

Stop recording triggers

Member Function Documentation

std::set<std::string> cppcms::triggers_recorder::detach ( )

Stop recording triggers and get the set of all triggers being added in its scope


The documentation for this class was generated from the following file: