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


PHP AMP_cache_set函数代码示例

本文整理汇总了PHP中AMP_cache_set函数的典型用法代码示例。如果您正苦于以下问题:PHP AMP_cache_set函数的具体用法?PHP AMP_cache_set怎么用?PHP AMP_cache_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _init_map_values

 function _init_map_values()
 {
     $cache_key = AMP_CACHE_TOKEN_XML_DATA . get_class($this);
     //check for cached version of map
     if ($map =& AMP_cache_get($cache_key)) {
         return $map;
     }
     //load map values from XML
     $map_source = new AMPSystem_XMLEngine('Map');
     $map = $map_source->readData();
     if (!$map) {
         return array();
     }
     //load custom extensions to XML map
     $map_extensions_source = new AMPSystem_XMLEngine('Map_Override');
     $map_extensions = $map_extensions_source->readData();
     if (!$map_extensions) {
         $complete_map =& $map;
     } else {
         $complete_map = array_merge($map, $map_extensions);
     }
     //cache the map
     AMP_cache_set($cache_key, $complete_map);
     return $complete_map;
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:25,代码来源:Map.inc.php

示例2: _update_image_cache_delete

 function _update_image_cache_delete($image_name)
 {
     $imageRef =& new AMP_System_File_Image(AMP_image_path($image_name, AMP_IMAGE_CLASS_ORIGINAL));
     $image_cache_key = $imageRef->getCacheKeySearch();
     $image_cache =& AMP_cache_get($image_cache_key);
     if (!$image_cache) {
         return;
     }
     unset($image_cache[$image_name]);
     AMP_cache_set($image_cache_key, $image_cache);
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:11,代码来源:Observer.inc.php

示例3: loadNavs

 function loadNavs()
 {
     //check for cached version
     $cache_key = AMP_CACHE_TOKEN_XML_DATA . $this->_filename_navs;
     $nav_set =& AMP_cache_get($cache_key);
     if (!$nav_set) {
         $nav_set = $this->_init_nav_values();
         if (!$nav_set) {
             return false;
         }
         $this->convertPermissions($nav_set);
         AMP_cache_set($cache_key, $nav_set);
     }
     foreach ($nav_set as $name => $item) {
         $new_nav =& $this->addNav($name, $item);
     }
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:17,代码来源:Manager.inc.php

示例4: readFields

 function readFields()
 {
     if (!($file_name = $this->getFieldFile())) {
         return false;
     }
     //check for cached field defs
     $cache_key = AMP_CACHE_TOKEN_XML_DATA . $file_name;
     if ($fields =& AMP_cache_get($cache_key)) {
         return $fields;
     }
     //reload def from XML file
     $fields = $this->_readXML($file_name);
     if ($fields) {
         $fields = array_merge($fields, $this->_getFieldOverrides($file_name));
         AMP_cache_set($cache_key, $fields);
         return $fields;
     }
     return false;
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:19,代码来源:XML.inc.php

示例5: putmemcache

function putmemcache($key, $rs, $host, $port, $compress, $debug = false)
{
    $false = false;
    $true = true;
    $AMP_key = AMP_CACHE_TOKEN_ADODB . $key;
    if ($success = AMP_cache_set($AMP_key, $rs)) {
        return $true;
    } else {
        return false;
    }
    /***
     * ADODB standard library memcache code
     * not used by AMP
     **/
    if (!function_exists('memcache_pconnect')) {
        if ($debug) {
            ADOConnection::outp(" Memcache module PECL extension not found!<br>\n");
        }
        return $false;
    }
    $memcache = new Memcache();
    if (!@$memcache->pconnect($host, $port)) {
        if ($debug) {
            ADOConnection::outp(" Can't connect to memcache server on: {$host}:{$port}<br>\n");
        }
        return $false;
    }
    $rs->timeCreated = time();
    if (!$memcache->set($key, $rs, $compress, 0)) {
        if ($debug) {
            ADOConnection::outp(" Failed to save data at the memcached server!<br>\n");
        }
        return $false;
    }
    return $true;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:36,代码来源:adodb-memcache.lib.inc.php

示例6: ampredirect

    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    For further information, contact Radical Designs at info@radicaldesigns.org

*******************************************/
$intro_id = 2;
require_once "AMP/BaseDB.php";
//if the frontpage timeout is actually set it will have a different value from the CACHE_TIMEOUT
//otherwise no one cares about this case
if (($cached_output = AMP_cached_request()) && AMP_SYSTEM_CACHE_TIMEOUT_FRONTPAGE == AMP_SYSTEM_CACHE_TIMEOUT || $cached_output && ($cached_frontpage_stamp = AMP_cache_get(AMP_CACHE_TOKEN_URL_CONTENT . '_TIMESTAMP_FRONTPAGE')) && AMP_SYSTEM_CACHE_TIMEOUT_FRONTPAGE >= time() - $cached_frontpage_stamp) {
    print $cached_output;
    exit;
}
require_once "AMP/BaseTemplate.php";
if ('index.php' != AMP_CONTENT_URL_FRONTPAGE) {
    ampredirect(AMP_CONTENT_URL_FRONTPAGE);
}
$currentPage =& AMPContent_Page::instance();
$currentPage->setListType(AMP_CONTENT_LISTTYPE_FRONTPAGE);
require_once 'AMP/Content/Class.inc.php';
$currentClass = new ContentClass(AMP_Registry::getDbcon(), AMP_CONTENT_CLASS_FRONTPAGE);
$display =& $currentClass->getDisplay();
$currentPage->contentManager->addDisplay($display);
AMP_cache_set(AMP_CACHE_TOKEN_URL_CONTENT . '_TIMESTAMP_FRONTPAGE', time());
require_once 'AMP/BaseFooter.php';
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:index.php

示例7: search

 function search($folder_path = false, $filename_pattern = '*')
 {
     if (!$folder_path) {
         return false;
     }
     if (substr($folder_path, -1) !== DIRECTORY_SEPARATOR) {
         $folder_path .= DIRECTORY_SEPARATOR;
     }
     $complete_path = $folder_path . $filename_pattern;
     $folder_cache_key = AMP_CACHE_TOKEN_DIR . $complete_path;
     $class_name = $this->_class_name;
     $search_total = 0;
     $result_set = array();
     $dir_contents = $this->_search_limit ? false : AMP_cache_get($folder_cache_key);
     if (!$dir_contents) {
         $files = $this->sort_glob(glob($this->create_glob_expression(array('path' => $folder_path, 'pattern' => $filename_pattern)), GLOB_BRACE));
         foreach ($files as $file_name) {
             if (!is_file($file_name)) {
                 continue;
             }
             $search_total++;
             if (isset($this->_search_offset) && $search_total < $this->_search_offset) {
                 continue;
             }
             if (isset($this->_search_limit) && count($result_set) >= $this->_search_limit) {
                 break;
             }
             $result_set[basename($file_name)] =& new $class_name($file_name);
         }
         //Cache Folder results for large searches
         if (count($result_set) > 500 && !$this->_search_limit) {
             AMP_cache_set($folder_cache_key, $result_set);
         }
     } else {
         $result_set =& $dir_contents;
     }
     #$this->sort( $result_set );
     return $result_set;
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:39,代码来源:File.php

示例8: _register_fields

 function _register_fields()
 {
     $md = $this->_module_def;
     $fields = array_map(array(&$this, "_register_fields_filter"), array_keys($md));
     $keys = array('label', 'public', 'type', 'required', 'values', 'lookup', 'size', 'enabled');
     foreach ($fields as $fname) {
         if (!$fname) {
             continue;
         }
         if (!$this->admin) {
             if (!isset($md['enabled_' . $fname])) {
                 continue;
             }
             if (!$md['enabled_' . $fname]) {
                 continue;
             }
         }
         $field = array();
         foreach ($keys as $key) {
             $field[$key] = $md[$key . "_" . $fname];
         }
         $field = $this->_register_lookups($field);
         $this->fields[$fname] = $field;
     }
     //Publish Field Hack
     if ($this->admin && $md['publish']) {
         $publish_field = array('type' => 'checkbox', 'label' => '<span class=publish_label>PUBLISH</span>', 'required' => false, 'public' => false, 'values' => 0, 'size' => null, 'enabled' => true);
         $this->fields['publish'] = $publish_field;
     }
     //override from custom folder
     $override_file_name = 'form' . $this->instance . '.xml';
     $override_fields = false;
     $cache_key = AMP_CACHE_TOKEN_XML_DATA . $override_file_name;
     if (!($override_fields =& AMP_cache_get($cache_key))) {
         if (file_exists_incpath($override_file_name)) {
             require 'AMP/System/XMLEngine.inc.php';
             $fieldsource =& new AMPSystem_XMLEngine($override_file_name);
             $override_fields = $fieldsource->readData();
         }
     }
     if ($override_fields) {
         $this->fields = array_merge($this->fields, $override_fields);
         AMP_cache_set($cache_key, $override_fields);
     }
     return true;
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:46,代码来源:UserData.php

示例9: GenerateCode

 function GenerateCode()
 {
     // reset code
     $this->sCode = '';
     // loop through and generate the code letter by letter
     for ($i = 0; $i < $this->iNumChars; $i++) {
         if (count($this->aCharSet) > 0) {
             // select random character and add to code string
             $this->sCode .= $this->aCharSet[array_rand($this->aCharSet)];
         } else {
             // select random character and add to code string
             $this->sCode .= chr(rand(65, 90));
         }
     }
     // save code in session variable
     $captcha_code = $this->bCaseInsensitive ? strtoupper($this->sCode) : $this->sCode;
     AMP_cache_set(CAPTCHA_SESSION_ID, $captcha_code);
     AMP_Form_Element_Captcha::create(CAPTCHA_SESSION_ID, $this->sCode);
     //$_SESSION[CAPTCHA_SESSION_ID] = $captcha_code;
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:20,代码来源:Captcha.inc.php

示例10: _init_fields

 function _init_fields()
 {
     if (!empty($this->_fields)) {
         return $this->_fields;
     }
     $modin = $this->getModin();
     if (!$modin) {
         return false;
     }
     $sourceDef = get_class($this) . $modin;
     //check registry for field defs
     $reg =& AMP_Registry::instance();
     $definedSources =& $reg->getEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
     if (!$definedSources) {
         $definedSources = AMP_cache_get(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
     }
     if ($definedSources && isset($definedSources[$sourceDef])) {
         return $definedSources[$sourceDef];
     }
     require_once 'AMP/System/UserData.php';
     $moduleSource =& new AMPSystem_UserData($this->dbcon, $modin);
     if (!$moduleSource->hasData()) {
         return false;
     }
     $md = $moduleSource->getData();
     $fields = $this->_allowed_keys;
     $keys = array('label', 'public', 'type', 'required', 'values', 'lookup', 'size', 'enabled');
     foreach ($fields as $fname) {
         if (!$fname) {
             continue;
         }
         if (!(isset($md['enabled_' . $fname]) && $md['enabled_' . $fname])) {
             continue;
         }
         $field = array();
         foreach ($keys as $key) {
             $field[$key] = $md[$key . "_" . $fname];
         }
         $field = $this->_register_lookups($field);
         $this->_fields[$fname] = $field;
     }
     //Publish Field Hack
     if ($md['publish']) {
         $publish_field = array('type' => 'checkbox', 'label' => '<span class=publish_label>PUBLISH</span>', 'required' => false, 'public' => false, 'values' => 0, 'size' => null, 'enabled' => true);
         $this->_fields['publish'] = $publish_field;
     }
     //cache field defs to registry
     $definedSources[$sourceDef] = $this->_fields;
     $reg->setEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
     AMP_cache_set(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
     return $this->_fields;
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:52,代码来源:Profile.php

示例11: AMP_get_cache

 function &instance($type, $instance_var = null, $lookup_baseclass = "AMPSystemLookup", $clear_existing = false)
 {
     static $lookup_set = false;
     static $cache = false;
     $empty_value = false;
     if (!$cache) {
         $cache = AMP_get_cache();
     }
     $req_class = $lookup_baseclass . '_' . ucfirst($type);
     if (!class_exists($req_class)) {
         trigger_error(sprintf(AMP_TEXT_ERROR_LOOKUP_NOT_FOUND, $req_class));
         return $empty_value;
     }
     if (!isset($instance_var)) {
         if ($clear_existing) {
             unset($lookup_set[$type]);
             return $empty_value;
         }
         //standard lookup
         if (!isset($lookup_set[$type])) {
             $lookup_cache_key = AMPSystem_Lookup::cache_key($type, $instance_var);
             $cached_lookup = AMP_cache_get($lookup_cache_key);
             if (!($cached_lookup && (!method_exists($cached_lookup, 'allow_cache') || $cached_lookup->allow_cache()))) {
                 $lookup_set[$type] = new $req_class();
                 if (!method_exists($lookup_set[$type], 'allow_cache') || $lookup_set[$type]->allow_cache()) {
                     AMP_cache_set($lookup_cache_key, $lookup_set[$type]);
                 }
             } else {
                 $lookup_set[$type] = $cached_lookup;
             }
         }
     } else {
         //instanced lookup
         if (!isset($lookup_set[$type])) {
             $lookup_set[$type] = array();
         }
         if ($clear_existing) {
             unset($lookup_set[$type][$instance_var]);
             return $empty_value;
         }
         if (!isset($lookup_set[$type][$instance_var])) {
             $lookup_cache_key = AMPSystem_Lookup::cache_key($type, $instance_var);
             $cached_lookup = AMP_cache_get($lookup_cache_key);
             if (!$cached_lookup) {
                 $lookup_set[$type][$instance_var] = new $req_class($instance_var);
                 AMP_cache_set($lookup_cache_key, $lookup_set[$type][$instance_var]);
             } else {
                 $lookup_set[$type][$instance_var] = $cached_lookup;
             }
         }
         return $lookup_set[$type][$instance_var]->dataset;
     }
     //AMP_cache_set( AMP_CACHE_TOKEN_LOOKUP . 'Master__' . AMP_SYSTEM_USER_ID, $lookup_set );
     return $lookup_set[$type]->dataset;
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:55,代码来源:Lookups.inc.php

示例12: require_once

/*
require_once( 'AMP/System/Lookups.inc.php');
$sites = AMP_lookup( 'subsites');
$server_name = $_SERVER['SERVER_NAME'];
foreach( $sites as $site_id => $site_url ) {
    if ( strpos( $site_url, $_SERVER['SERVER_NAME'])) {
        define( 'AMP_SYSTEM_SETTING_DB_ID', $site_id );
        trigger_error( 'found site id ' . $site_id );
    }
}
if ( !defined( 'AMP_SYSTEM_SETTING_DB_ID')) {
    define( 'AMP_SYSTEM_SETTING_DB_ID', AMP_CONTENT_SECTION_ID_ROOT );
}
*/
//check cache
$system_setup_key = 'SYSTEM_SETUP_' . AMP_SYSTEM_UNIQUE_ID . '_' . AMP_SYSTEM_SETTING_DB_ID;
if (!($SystemSetup = AMP_cache_get($system_setup_key))) {
    $SystemSetup = new AMP_System_Setup(AMP_Registry::getDbcon());
    AMP_cache_set($system_setup_key, $SystemSetup);
}
$SystemSetup->execute();
//default timezone for php 5.3
if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('America/Los_Angeles');
}
// enable memcache for adodb if memcache is active
if (($cache =& AMP_get_cache()) && strtolower(get_class($cache)) == 'amp_system_cache_memcache') {
    $dbcon =& AMP_Registry::getDbcon();
    $dbcon->memcache = true;
    $dbcon->cacheSecs = AMP_SITE_CACHE_TIMEOUT;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:Setup.php

示例13: _doDisplay

 /**
  * Returns the output of a display object
  *
  * If the optional name parameter is passed, the {@link _displays_executed} flag is set. If this flag is already
  * set for the specified name, a value of false is returned.
  *
  * If a local method is found having the form _doDisplay[Name], that method is performed on the $display object
  * and the result returned. ( see {@link _doDisplayBuffer} for an example )
  *
  * If no such method is found, the "execute" method of the display object is called and the result returned.
  * 
  * @param   object  $display    Display object to be executed
  * @param   string  $name       String key of display object 
  * @since   3.5.3
  * @access  protected
  * @return  string  Output from the display 
  */
 function _doDisplay(&$display, $name = null)
 {
     if (!isset($name)) {
         return $display->execute();
     }
     if (isset($this->_displays_executed[$name]) && $this->_displays_executed[$name]) {
         return false;
     }
     $this->_displays_executed[$name] = true;
     if ($name) {
         $display_method = '_doDisplay' . ucfirst($name);
         if (method_exists($this, $display_method)) {
             return $this->{$display_method}($display);
         }
     }
     //cache the display output for standard displays
     if (isset($this->_displays_cacheable[$name])) {
         $output = $display->execute();
         AMP_cache_set($this->_displays_cacheable[$name], $output);
         return $output;
     }
     return $display->execute();
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:40,代码来源:Manager.inc.php

示例14: cacheComponent

 function cacheComponent(&$component)
 {
     if (AMP_DEBUG_MODE_COMPONENT_CACHE_INACTIVE) {
         return true;
     }
     $id = isset($component->id) ? $component->id : null;
     $cache_key = $this->getCacheKey($component, $id);
     if (!$cache_key) {
         return false;
     }
     return AMP_cache_set($cache_key, $component);
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:12,代码来源:ComponentMap.inc.php

示例15: preg_replace

$pattern = '/src\s?=\s?\'((?!http)[\w\d\.\/?= -]*)\'/i';
$replace = 'src="'.$url.'/$1"';
$data =  preg_replace($pattern, $replace, $data);

$pattern = '/background\s?=\s?"((?!http)[\w\d\.\/?= -]*)"/i';
$replace = 'background="'.$url.'/$1"';
$data =  preg_replace($pattern, $replace, $data);

$pattern = '/action\s?=\s?"((?!http)[\w\d\.\/?= -]*)"/i';
$replace = 'action="'.$url.'/$1"';
$data =  preg_replace($pattern, $replace, $data);

$pattern = '/,\'\',\'((?!http)[\w\d\.\/?= -]*)\'/i';
$replace = ',\'\',\''.$url.'/$1\'';
$data =  preg_replace($pattern, $replace, $data);

$pattern = array( "\r", "\n" );
$finalPageHtml =  str_replace($pattern, '', $data);
*/
$finalPageHtml = AMP_absolute_urls($nav_output);
if ($format == 'js') {
    $nav_id = $position . mt_rand(1000, 10000);
    $finalPageHtml = AMP_js_write($finalPageHtml, $nav_id);
    //$finalPageHtml = 'var '.$nav_id.'=  { value: \''. str_replace( "'", "\'", $finalPageHtml ) . "'};\ndocument.write( ".$nav_id.".value );";
}
print $finalPageHtml;
if (AMP_is_cacheable_url()) {
    $cache_key = AMP_CACHE_TOKEN_URL_CONTENT . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    $user_id = defined('AMP_SYSTEM_USER_ID') && AMP_SYSTEM_USER_ID ? AMP_SYSTEM_USER_ID : null;
    AMP_cache_set($cache_key, $finalPageHtml, $user_id);
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:nav_widget.php


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