diff options
| author | spider@app1 <spiderr@bitweaver.org> | 2016-06-17 00:13:39 -0400 |
|---|---|---|
| committer | spider@app1 <spiderr@bitweaver.org> | 2016-06-17 00:13:39 -0400 |
| commit | 3ebed9ade0609ded87c1657704b85ed0e4e82ba4 (patch) | |
| tree | 774a964b6deb866296eec35e67163a41f246d2d8 | |
| parent | c917c8b0d73e1e4accd34f7b3eb8be91768e8aec (diff) | |
| download | wiki-3ebed9ade0609ded87c1657704b85ed0e4e82ba4.tar.gz wiki-3ebed9ade0609ded87c1657704b85ed0e4e82ba4.tar.bz2 wiki-3ebed9ade0609ded87c1657704b85ed0e4e82ba4.zip | |
improve apcu object caching
| -rw-r--r-- | BitPage.php | 22 | ||||
| -rw-r--r-- | lookup_page_inc.php | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/BitPage.php b/BitPage.php index 5bdd6aa..c8584b4 100644 --- a/BitPage.php +++ b/BitPage.php @@ -18,11 +18,11 @@ require_once( LIBERTY_PKG_PATH.'LibertyMime.php' ); /** * @package wiki */ -class BitPage extends LibertyMime { +class BitPage extends LibertyMime implements BitCacheable { var $mPageId; var $mPageName; - function BitPage( $pPageId=NULL, $pContentId=NULL ) { + function __construct( $pPageId=NULL, $pContentId=NULL ) { parent::__construct(); $this->registerContentType( BITPAGE_CONTENT_TYPE_GUID, array( 'content_type_guid' => BITPAGE_CONTENT_TYPE_GUID, @@ -43,6 +43,22 @@ class BitPage extends LibertyMime { $this->mAdminContentPerm = 'p_wiki_admin'; } + public static function isCacheableClass() { + return true; + } + + public function isCacheableObject() { + return true; + } + + public static function getCacheClass() { + return 'BitPage'; + } + + public function __sleep() { + return array_merge( parent::__sleep(), array( 'mPageId', 'mPageName' ) ); + } + public static function findContentIdByPageId( $pPageId ) { global $gBitDb; $ret = NULL; @@ -79,7 +95,7 @@ class BitPage extends LibertyMime { // Fix nignx mapping of '+' sign when doing rewrite $loadPage = str_replace("+", " ", $loadPage ); - if( $loadPage && $existsInfo = self::pageExists( $loadPage ) ) { + if( $loadPage && $existsInfo = static::pageExists( $loadPage ) ) { if (count($existsInfo)) { if (count($existsInfo) > 1) { // Perhaps something should be done on page conflicts diff --git a/lookup_page_inc.php b/lookup_page_inc.php index 3de07ee..33650be 100644 --- a/lookup_page_inc.php +++ b/lookup_page_inc.php @@ -59,7 +59,7 @@ if( empty( $gContent ) || !is_object( $gContent ) || strtolower( get_class( $gCo } if( !empty( $loadContentId ) ) { - $gContent = LibertyBase::getLibertyObject( $loadContentId ); + $gContent = BitPage::getLibertyObject( $loadContentId ); } if( empty( $gContent ) || !is_object( $gContent ) ) { |
