Go Back    Forum > Digital Publishing / Web Sites > Website and Server Troubleshooting

Reply
 
LinkBack Thread Tools
  #1  
03-10-2011, 06:20 PM
admin's Avatar
admin admin is offline
Site Staff | Web Development
 
Join Date: Jul 2003
Posts: 4,310
Thanked 654 Times in 457 Posts
Requirements:
  • vBulletin 3.7.x or 3.8.x,
  • WinCache 1.1 or higher

STEP 1 -- Add the following code to the end of class_datastore.php, just above ?> code

Code:
// #############################################################################
// WINCACHE

/**
* Class for fetching and initializing the vBulletin datastore from WINCACHE
*/

class vB_Datastore_WINCACHE extends vB_Datastore
{
                /**
                * Indicates if the result of a call to the register function should store the value in memory
                *
                * @var  boolean
                */

                var $store_result = false;
 
                /**
                * Fetches the contents of the datastore from WINCACHE
                *
                * @param           array      Array of items to fetch from the datastore
                *
                * @return           void
                */
                function fetch($itemarray)
                {
                                if (!function_exists('wincache_ucache_get'))
                                {
                                                trigger_error('WINCACHE not installed', E_USER_ERROR);
                                }
 
                                $db =& $this->dbobject;
 
                                $itemlist = array();
 
                                foreach ($this->defaultitems AS $item)
                                {
                                                $this->do_fetch($item, $itemlist);
                                }
 
                                if (is_array($itemarray))
                                {
                                                foreach ($itemarray AS $item)
                                                {
                                                                $this->do_fetch($item, $itemlist);
                                                }
                                }
 
                                $this->store_result = true;
 
                                // some of the items we are looking for were not found, lets get them in one go
                                if (!empty($itemlist))
                                {
                                                $this->do_db_fetch(implode(',', $itemlist));
                                }
 
                                $this->check_options();
 
                                // set the version number variable
                                $this->registry->versionnumber =& $this->registry->options['templateversion'];
                }
 
                /**
                * Fetches the data from shared memory and detects errors
                *
                * @param           string     title of the datastore item
                * @param           array      A reference to an array of items that failed and need to fetched from the database
                *
                * @return           boolean
                */
                function do_fetch($title, &$itemlist)
                {
                                $ptitle = $this->prefix . $title;
 
                                if (($data = wincache_ucache_get($ptitle)) === false)
                                { // appears its not there, lets grab the data, lock the shared memory and put it in
                                                $itemlist[] = "'" . $this->dbobject->escape_string($title) . "'";
                                                return false;
                                }
                                $this->register($title, $data);
                                return true;
                }
 
                /**
                * Sorts the data returned from the cache and places it into appropriate places
                *
                * @param           string     The name of the data item to be processed
                * @param           mixed   The data associated with the title
                *
                * @return           void
                */
                function register($title, $data, $unserialize_detect = 2)
                {
                                if ($this->store_result === true)
                                {
                                                $this->build($title, $data);
                                }
                                parent::register($title, $data, $unserialize_detect);
                }
 
                /**
                * Updates the appropriate cache file
                *
                * @param           string     title of the datastore item
                * @param           mixed   The data associated with the title
                *
                * @return           void
                */
                function build($title, $data)
                {
                                $ptitle = $this->prefix . $title;
                                //The below line is not required as wincache_ucache_set will override the data if it is already present
                                //wincache_ucache_delete($ptitle);
                                wincache_ucache_set($ptitle, $data);
                }
}
STEP 2 -- Set includes\config.php to use WinCache as the datastore:

Code:
$config['Datastore']['class'] = 'vB_Datastore_WINCACHE';
Check the "User and Session Cache" section of wincache.php in your browser to see stats.

Note that wincache.php was a test file that came with WinCache, and must be placed into the domain folder with your vBulletin install. The PHP file will not work until the username/password is changed, which can only be done after the read-only file is temporarily made writable. WinCache only works on a Windows 2008 IIS 7 server, and is an optional module that must be installed from IIS.net.

- Did this site help you? Then upgrade to Premium Member and show your support!
- Also: Like Us on Facebook for special DVD/Blu-ray news and deals!
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Wincache settings for WordPress [notes] admin Website and Server Troubleshooting 0 03-10-2011 05:42 PM
Disable VLC media player's "Rebuild font cache" error message admin Videography: Cameras, TVs and Players 1 02-03-2011 10:12 AM
IIS7 URL Rewrite Module support added since WordPress v2.8 lordsmurf Website and Server Troubleshooting 0 10-01-2010 03:44 AM
Project notes, VHS restoration (GK@2008) admin Project Planning, Workflows 2 11-29-2009 11:05 AM
Availables blogs/CMS [NOTES] admin Web Development, Design 0 08-11-2009 12:42 AM




 
All times are GMT -5. The time now is 06:26 PM