Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions
Zend_Memory Class Reference

Static Public Member Functions

static factory ($backend, $backendOptions=array())
 

Detailed Description

Definition at line 40 of file Memory.php.

Member Function Documentation

◆ factory()

static factory (   $backend,
  $backendOptions = array() 
)
static

Factory

Parameters
string$backendbackend name
array$backendOptionsassociative array of options for the corresponding backend constructor
Returns
Zend_Memory_Manager
Exceptions
Zend_Memory_Exception

Definition at line 50 of file Memory.php.

51  {
52  if (strcasecmp($backend, 'none') == 0) {
53  return new Zend_Memory_Manager();
54  }
55 
56  // Look through available backendsand
57  // (that allows to specify it in any case)
58  $backendIsFound = false;
59  foreach (Zend_Cache::$standardBackends as $zendCacheBackend) {
60  if (strcasecmp($backend, $zendCacheBackend) == 0) {
61  $backend = $zendCacheBackend;
62  $backendIsFound = true;
63  break;
64  }
65  }
66 
67  if (!$backendIsFound) {
68  #require_once 'Zend/Memory/Exception.php';
69  throw new Zend_Memory_Exception("Incorrect backend ($backend)");
70  }
71 
72  $backendClass = 'Zend_Cache_Backend_' . $backend;
73 
74  // For perfs reasons, we do not use the Zend_Loader::loadClass() method
75  // (security controls are explicit)
76  #require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
77 
78  $backendObject = new $backendClass($backendOptions);
79 
80  return new Zend_Memory_Manager($backendObject);
81  }
static $standardBackends
Definition: Cache.php:43

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