当前位置: 首页>>代码示例>>PHP>>正文


PHP SS_Cache::add_backend方法代码示例

本文整理汇总了PHP中SS_Cache::add_backend方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_Cache::add_backend方法的具体用法?PHP SS_Cache::add_backend怎么用?PHP SS_Cache::add_backend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SS_Cache的用法示例。


在下文中一共展示了SS_Cache::add_backend方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpOnce

 public function setUpOnce()
 {
     parent::setUpOnce();
     // set backend
     SS_Cache::add_backend(self::$backend_name, new MongodbBackend(self::$cache_opts));
     SS_Cache::pick_backend(self::$backend_name, self::$cache_name, 100);
 }
开发者ID:notthatbad,项目名称:silverstripe-caching,代码行数:7,代码来源:MongoCacheBackendTest.php

示例2: list

            list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
            if (strlen($_SERVER['PHP_AUTH_USER']) == 0 || strlen($_SERVER['PHP_AUTH_PW']) == 0) {
                unset($_SERVER['PHP_AUTH_USER']);
                unset($_SERVER['PHP_AUTH_PW']);
            }
        }
    }
    BasicAuth::protect_entire_site();
}
// CodeEditorField integration
if (class_exists('CodeEditorField')) {
    HtmlEditorConfig::get('cms')->enablePlugins(array('aceeditor' => '../../../codeeditorfield/javascript/tinymce/editor_plugin_src.js'));
    HtmlEditorConfig::get('cms')->insertButtonsBefore('fullscreen', 'aceeditor');
    HtmlEditorConfig::get('cms')->removeButtons('code');
}
if (defined('DEVTOOLKIT_USE_APC') && DEVTOOLKIT_USE_APC) {
    SS_Cache::add_backend('two_level', 'Two-Levels', array('slow_backend' => 'File', 'fast_backend' => 'APC', 'slow_backend_options' => array('cache_dir' => TEMP_FOLDER)));
    SS_Cache::pick_backend('two_level', 'any', 10);
}
if (defined('DEVTOOLKIT_USE_MEMCACHED') && DEVTOOLKIT_USE_MEMCACHED) {
    // Note : this use the Memcache extension, not the Memcached extension
    // (with a 'd' - which use libmemcached)
    // Install from https://pecl.php.net/package/memcache
    // For windows : https://mnshankar.wordpress.com/2011/03/25/memcached-on-64-bit-windows/
    SS_Cache::add_backend('two_level', 'Two-Levels', array('slow_backend' => 'File', 'fast_backend' => 'Memcached', 'slow_backend_options' => array('cache_dir' => TEMP_FOLDER), 'fast_backend_options' => array('servers' => array('host' => defined('MEMCACHE_HOST') ? MEMCACHE_HOST : 'localhost', 'port' => defined('MEMCACHE_PORT') ? MEMCACHE_PORT : 11211, 'persistent' => true, 'weight' => 1, 'timeout' => 5, 'retry_interval' => 15, 'status' => true, 'failure_callback' => null))));
    SS_Cache::pick_backend('two_level', 'any', 10);
}
// Really basic newrelic integration
if (defined('NEWRELIC_APP_NAME')) {
    newrelic_set_appname(NEWRELIC_APP_NAME . ";Silverstripe");
}
开发者ID:lekoala,项目名称:silverstripe-devtoolkit,代码行数:31,代码来源:_config.php

示例3: getTempFolder

 */
ContentController::add_extension('CustomHtmlFormPage_Controller');
Security::add_extension('CustomHtmlFormPage_Controller');
SiteConfig::add_extension('CustomHtmlFormConfiguration');
$cacheBaseDir = getTempFolder() . DIRECTORY_SEPARATOR . 'cache';
$cacheDir = $cacheBaseDir . DIRECTORY_SEPARATOR . 'CustomHtmlForm';
if (Director::isDev()) {
    $cachelifetime = 1;
} else {
    $cachelifetime = 86400;
}
if (!is_dir($cacheDir)) {
    if (!is_dir($cacheBaseDir)) {
        mkdir($cacheBaseDir);
    }
    mkdir($cacheDir);
}
if (class_exists('SilvercartCleanCacheTask')) {
    SilvercartCleanCacheTask::register_cache_directory($cacheDir);
}
SS_Cache::set_cache_lifetime('CustomHtmlForm', $cachelifetime);
SS_Cache::add_backend('CustomHtmlForm', 'File', array('cache_dir' => $cacheDir, 'hashed_directory_level' => 2));
SS_Cache::pick_backend('CustomHtmlForm', 'CustomHtmlForm');
if (class_exists('RequirementsEngine')) {
    RequirementsEngine::registerJsFile('customhtmlform/script/jquery.js');
    RequirementsEngine::registerJsFile('customhtmlform/script/jquery.scrollTo.min.js');
    RequirementsEngine::registerJsFile('customhtmlform/script/jquery.pixeltricks.forms.checkFormData.js');
    RequirementsEngine::registerJsFile('customhtmlform/script/jquery.pixeltricks.forms.events.js');
    RequirementsEngine::registerJsFile('customhtmlform/script/jquery.pixeltricks.forms.validator.js');
    RequirementsEngine::registerJsFile(SAPPHIRE_DIR . "/javascript/i18n.js");
}
开发者ID:silvercart,项目名称:customhtmlform,代码行数:31,代码来源:_config.php

示例4: dirname

<?php

global $project;
$project = 'mysite';
include_once dirname(__FILE__) . '/local.conf.php';
if (!defined('SS_LOG_FILE')) {
    define('SS_LOG_FILE', '/var/log/silverstripe/' . basename(dirname(dirname(__FILE__))) . '.log');
}
SS_Log::add_writer(new SS_LogFileWriter(SS_LOG_FILE), SS_Log::NOTICE, '<=');
// Sets up relevant cache settings to prevent permission errors
SS_Cache::add_backend('default', 'File', array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache', 'hashed_directory_umask' => 2775, 'cache_file_umask' => 0660));
require_once 'Zend/Cache.php';
require_once 'Zend/Date.php';
$coreCache = Zend_Cache::factory('Core', 'File', array(), array('hashed_directory_umask' => 2775, 'cache_file_umask' => 0660, 'cache_dir' => TEMP_FOLDER));
Zend_Date::setOptions(array('cache' => $coreCache));
开发者ID:sweddell,项目名称:silverstripe-base,代码行数:15,代码来源:_config.php

示例5: getCache

 /**
  * Returns the caching factory
  *
  * @return Zend_Cache_Core
  */
 protected function getCache()
 {
     // Determine cache parameters
     $backend = self::config()->cacheBackend;
     // Create default backend if not overridden
     if ($backend === 'DynamicCache') {
         $cacheDir = str_replace(array('%BASE_PATH%', '%ASSETS_PATH%'), array(BASE_PATH, ASSETS_PATH), self::config()->cacheDir);
         // Using own folder helps with separating page cache from other SS cached elements
         // TODO Use Filesystem::isAbsolute() once $_ENV['OS'] bug is fixed (should use getenv())
         if ($cacheDir[0] !== '/') {
             $cacheDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . $cacheDir;
         }
         if (!is_dir($cacheDir)) {
             mkdir($cacheDir);
         }
         SS_Cache::add_backend('DynamicCacheStore', 'File', array('cache_dir' => $cacheDir));
         SS_Cache::pick_backend('DynamicCacheStore', $backend, 1000);
     }
     // Set lifetime, allowing for 0 (infinite) lifetime
     if (($lifetime = self::config()->cacheDuration) !== null) {
         SS_Cache::set_cache_lifetime($backend, $lifetime);
     }
     // Get factory from this cache
     return SS_Cache::factory($backend);
 }
开发者ID:tractorcow,项目名称:silverstripe-dynamiccache,代码行数:30,代码来源:DynamicCache.php

示例6: getCache

 /**
  * Returns the caching factory
  *
  * @return Zend_Cache_Core
  */
 protected function getCache()
 {
     // Determine cache parameters
     $backend = self::config()->cacheBackend;
     // Create default backend if not overridden
     if ($backend === 'DynamicCache') {
         // Using own folder helps with separating page cache from other SS cached elements
         $cacheDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'dynamic_cache';
         if (!is_dir($cacheDir)) {
             mkdir($cacheDir);
         }
         SS_Cache::add_backend('DynamicCacheStore', 'File', array('cache_dir' => $cacheDir));
         SS_Cache::pick_backend('DynamicCacheStore', $backend, 1000);
     }
     // Set lifetime, allowing for 0 (infinite) lifetime
     if (($lifetime = self::config()->cacheDuration) !== null) {
         SS_Cache::set_cache_lifetime($backend, $lifetime);
     }
     // Get factory from this cache
     return SS_Cache::factory($backend);
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-dynamiccache,代码行数:26,代码来源:DynamicCache.php

示例7: configure_apc

 /**
  * 
  * @return boolean True if APCu is installed as an extension and is enabled in php.ini
  */
 public static function configure_apc()
 {
     $isApcEnabled = extension_loaded('apc') && ini_get('apc.enabled') == 1;
     if (!$isApcEnabled) {
         return false;
     }
     SS_Cache::add_backend(CACHEABLE_STORE_NAME, 'Apc');
     self::$current_mode = 'apc';
     return true;
 }
开发者ID:deviateltd,项目名称:silverstripe-cacheable,代码行数:14,代码来源:Cacheable.php

示例8: array

Config::inst()->update('WidgetSetAdmin', 'menuSortIndex', 20);
Config::inst()->update('ReportAdmin', 'menuSortIndex', 30);
Config::inst()->update('AssetAdmin', 'menuSortIndex', 1);
Config::inst()->update('SecurityAdmin', 'menuSortIndex', 30);
Config::inst()->update('CMSSettingsController', 'menuSortIndex', 1);
// ----------------------------------------------------------------------------
// Dirty bugfixes ....
// ----------------------------------------------------------------------------
if (array_key_exists('Email', $_POST)) {
    $_POST['Email'] = SilvercartTools::prepareEmailAddress($_POST['Email']);
}
$cacheDirectories = array('cacheblock' => getTempFolder() . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'cacheblock', 'silvercart' => getTempFolder() . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'silvercart');
if (Director::isDev()) {
    $cachelifetime = 1;
} else {
    $cachelifetime = 86400;
}
foreach ($cacheDirectories as $cacheName => $cacheDirectory) {
    SilvercartCleanCacheTask::register_cache_directory($cacheDirectory);
    if (!is_dir($cacheDirectory)) {
        mkdir($cacheDirectory);
    }
    SS_Cache::add_backend($cacheName, 'File', array('cache_dir' => $cacheDirectory, 'hashed_directory_level' => 1));
    SS_Cache::set_cache_lifetime($cacheName, $cachelifetime);
    SS_Cache::pick_backend($cacheName, $cacheName);
}
SS_Cache::set_cache_lifetime('aggregate', $cachelifetime);
/*
 * DO NOT ENABLE THE CREATION OF TEST DATA IN DEV MODE HERE!
 * THIS SHOULD BE PROJECT SPECIFIC.
 */
开发者ID:silvercart,项目名称:silvercart,代码行数:31,代码来源:_config.php

示例9: array

Config::inst()->update('Email', 'admin_email', $email_from);
//Register Shortcodes
ShortcodeParser::get()->register('Sched', array('Page', 'SchedShortCodeHandler'));
ShortcodeParser::get()->register('outlink', array('Page', 'ExternalLinkShortCodeHandler'));
ShortcodeParser::get()->register('icon', array('Page', 'IconShortCodeHandler'));
//cache configuration
/*
SS_Cache::add_backend('two-level', 'Two-Levels', array(
  'slow_backend' => 'File',
  'fast_backend' => 'Apc',
  'slow_backend_options' => array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache')
));

SS_Cache::pick_backend('two-level', 'any', 10); // No need for special backend for aggregate - TwoLevels with a File slow backend supports tags
*/
SS_Cache::add_backend('file-level', 'File', array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache'));
SS_Cache::pick_backend('file-level', 'any', 10);
SS_Cache::set_cache_lifetime($for = 'cache_entity_count', $lifetime = 3600, $priority = 100);
//entity counter extension
Object::add_extension('HomePage_Controller', 'EntityCounter');
Object::add_extension('AnniversaryPage_Controller', 'EntityCounter');
Object::add_extension('Group', 'GroupDecorator');
Object::add_extension('SecurityAdmin', 'SecurityAdminExtension');
//Force cache to flush on page load if in Dev mode (prevents needing ?flush=1 on the end of a URL)
if (Director::isDev()) {
    //Set default login
    Security::setDefaultAdmin('admin', 'pass');
}
/* TinyMCE Configuration */
$tinyMCE = HtmlEditorConfig::get('cms');
$tinyMCE->setOption('extended_valid_elements', '@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,i,em,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|name],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]');
开发者ID:Thingee,项目名称:openstack-org,代码行数:31,代码来源:_config.php

示例10: Minify_Requirements_Backend

<?php

if (Director::isLive()) {
    Controller::add_extension('SS_MinifiedResponseExtension');
    Requirements::set_backend(new Minify_Requirements_Backend());
    if (defined('MINIFY_CACHE_BACKEND') && defined('MINIFY_CACHE_LIFETIME')) {
        $backend = unserialize(MINIFY_CACHE_BACKEND);
        SS_Cache::add_backend('MINIFY_CACHE_BACKEND', $backend['Type'], $backend['Options']);
        SS_Cache::set_cache_lifetime('MINIFY_CACHE_BACKEND', MINIFY_CACHE_LIFETIME, 100);
        SS_Cache::pick_backend('MINIFY_CACHE_BACKEND', 'MINIFY_CACHE', 100);
    }
}
开发者ID:andrelohmann,项目名称:silverstripe-minify,代码行数:12,代码来源:_config.php

示例11: array

<?php

SS_Cache::add_backend('LatestTweets_cache', 'File', array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache'));
SS_Cache::set_cache_lifetime('LatestTweets_cache', 1800, 10);
SS_Cache::pick_backend('LatestTweets_cache', 'any', 10);
Object::add_extension('SiteConfig', 'LaTw_SiteConfig_Extension');
Object::add_extension('Page_Controller', 'LaTw_Page_Controller_Extension');
开发者ID:helpfulrobot,项目名称:unisolutions-silverstripe-latesttweets,代码行数:7,代码来源:_config.php

示例12: array

<?php

/**
 * Default configuration settings for Tumblr Feed module.
 *
 * You should not put your own configurations here; use your
 * mysite/_config.php file
 *
 * @package tumblrfeed
 */
SS_Cache::add_backend('tumblr_api_cache', 'File', array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache'));
SS_Cache::set_cache_lifetime('tumblr_api_cache', 1800, 10);
SS_Cache::pick_backend('tumblr_api_cache', 'any', 10);
Object::add_extension('SiteConfig', 'TumblrSiteConfigExtension');
开发者ID:tkiehne,项目名称:silverstripe-tumblrfeed,代码行数:14,代码来源:_config.php


注:本文中的SS_Cache::add_backend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。