本文整理汇总了PHP中SS_Cache::pick_backend方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_Cache::pick_backend方法的具体用法?PHP SS_Cache::pick_backend怎么用?PHP SS_Cache::pick_backend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS_Cache
的用法示例。
在下文中一共展示了SS_Cache::pick_backend方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
*
* @param SS_HTTPRequest $request
*/
public function run($request)
{
$newLine = CacheableNavigation_Rebuild::new_line();
SS_Cache::pick_backend(CACHEABLE_STORE_NAME, CACHEABLE_STORE_FOR, CACHEABLE_STORE_WEIGHT);
SS_Cache::factory(CACHEABLE_STORE_FOR)->clean('all');
echo 'Cleanup: ' . CACHEABLE_STORE_NAME . " done." . $newLine;
}
示例2: 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);
}
示例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");
}
示例4: 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");
}
示例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);
}
示例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);
}
示例7: 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.
*/
示例8: 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]');
示例9: 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);
}
}
示例10: 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');
示例11: define
<?php
/**
*
* @author Deviate Ltd 2014-2015 http://www.deviate.net.nz
* @package silverstripe-cachable
*
* Configure the module's storage:
*
* The default is to use "file" for the cache store via {@link Zend_Cache_Backend_File},
* but this can be overriden in YML config. See the README for more options.
*/
define('CACHEABLE_STORE_DIR_NAME', 'cacheable');
define('CACHEABLE_STORE_DIR_TEST', TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cacheable_tests');
define('CACHEABLE_STORE_NAME', 'cacheablestore');
define('CACHEABLE_STORE_FOR', 'Cacheable');
define('CACHEABLE_STORE_TAG_DEFAULT', 'cacheable_tag_nav');
// Default Zend tag name for this cache
define('CACHEABLE_STORE_TAG_DEFAULT_TEST', 'cacheable_tag_nav_test');
define('CACHEABLE_STORE_WEIGHT', 1000);
define('CACHEABLE_STORE_DIR', CacheableConfig::cache_dir_path());
define('CACHEABLE_MODULE_DIR', __DIR__);
CacheableConfig::configure();
SS_Cache::pick_backend(CACHEABLE_STORE_NAME, CACHEABLE_STORE_FOR, CACHEABLE_STORE_WEIGHT);
示例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');