Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Interfaces

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  * @package Nette\Caching
 7:  */
 8: 
 9: 
10: 
11: /**
12:  * Output caching helper.
13:  *
14:  * @author     David Grudl
15:  * @package Nette\Caching
16:  */
17: class CachingHelper extends Object
18: {
19:     /** @var array */
20:     public $dependencies;
21: 
22:     /** @var Cache */
23:     private $cache;
24: 
25:     /** @var string */
26:     private $key;
27: 
28: 
29:     public function __construct(Cache $cache, $key)
30:     {
31:         $this->cache = $cache;
32:         $this->key = $key;
33:         ob_start();
34:     }
35: 
36: 
37:     /**
38:      * Stops and saves the cache.
39:      * @param  array  dependencies
40:      * @return void
41:      */
42:     public function end(array $dependencies = NULL)
43:     {
44:         if ($this->cache === NULL) {
45:             throw new InvalidStateException('Output cache has already been saved.');
46:         }
47:         $this->cache->save($this->key, ob_get_flush(), (array) $dependencies + (array) $this->dependencies);
48:         $this->cache = NULL;
49:     }
50: 
51: }
52: 
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0