Development

#3862 (The Symfony Book: Listing 18-16 - Caching the Result of a Function :: Broken Example)

You must first sign up to be able to contribute.

Ticket #3862 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

The Symfony Book: Listing 18-16 - Caching the Result of a Function :: Broken Example

Reported by: superhaggis Assigned to: fabien
Priority: minor Milestone:
Component: other Version: 1.1.0
Keywords: cache documentation sfFileCache Cc:
Qualification: Unreviewed

Description

Listing reads:

  $cache = new sfFileCache(sfConfig::get('sf_cache_dir').'/function');
  $fc = new sfFunctionCache($cache);
  $result1 = $fc->call('cos', array(M_PI));
  $result2 = $fc->call('preg_replace', array('/\s\s+/', ' ', $input));

Results in:

  [sfInitializationException] You must pass a "cache_dir" option to initialize a sfFileCache object.

Example should be changed to:

  $cache = new sfFileCache(array(
    'cache_dir' => sfConfig::get('sf_cache_dir').'/function',
  ));
  $fc = new sfFunctionCache($cache);
  $result1 = $fc->call('cos', array(M_PI));
  $result2 = $fc->call('preg_replace', array('/\s\s+/', ' ', $input));

Thanks!

Change History

06/30/08 22:06:34 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [10028]) doc: fixed typo (closes #3862)