CppCMS
|
triggers_recorder is a class that allows you to record all triggers added in certain scope. More...
#include <cppcms/cache_interface.h>
Public Member Functions | |
triggers_recorder (cache_interface &) | |
~triggers_recorder () | |
std::set< std::string > | detach () |
Friends | |
class | cache_interface |
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.
Start recording all triggers
Stop recording triggers
std::set<std::string> cppcms::triggers_recorder::detach | ( | ) |
Stop recording triggers and get the set of all triggers being added in its scope