vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Board Optimization - Datastore cache to WinCache - boost your vBulletin (https://vborg.vbsupport.ru/showthread.php?t=239391)

hydn 03-29-2010 10:00 PM

Datastore cache to WinCache - boost your vBulletin
 
1 Attachment(s)
This allows you to use WinCache as a datastore cache in vBulletin. This also assumes that you have already installed Wincache version 1.1 or later. This is definitely your choice if you have already installed and enabled WinCache on your windows server. Use at your own risk!

(See screenshot of stats below after 30mins up-time)

Prerequisites
  • a working php installation
  • a working vBulletin 4.0.2 installation
  • a working WinCache 1.1 or Better.
Install the modification
  1. Add the following code to the end of class_datastore.php just above "?>"
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($items)
                {
                                if (!function_exists('wincache_ucache_get'))
                                {
                                                trigger_error('WINCACHE not installed', E_USER_ERROR);
                                }
 
                                if (!sizeof($items = $this->prepare_itemarray($items)))
                                {
                                                return;
                                }
 
                                $unfetched_items = array();
                                foreach ($items AS $item)
                                {
                                                $this->do_fetch($item, $unfetched_items);
                                }
 
                                $this->store_result = true;
 
                                // some of the items we are looking for were not found, lets get them in one go
                                if (!empty($unfetched_items))
                                {
                                                if (!($result = $this->do_db_fetch($this->prepare_itemlist($unfetched_items))))
                                                {
                                                                return false;
                                                }
                                }
 
                                $this->check_options();
                                return true;
                }
 
                /**
                * 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, &$unfetched_items)
                {
                                $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
                                                $unfetched_items[] = $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;
 
                                wincache_ucache_delete($ptitle);
                                wincache_ucache_set($ptitle, $data);
                }
 
}

2. Set your config.php to use wincache for datastore:

Code:

$config['Datastore']['class'] = 'vB_Datastore_WINCACHE';
Done!

Check the "User and Session Cache" section of your wincache.php (screenshot) in your browser to see stats!

Special thanks to the guys at Microsoft for their help! Official IIS support at http://forums.iis.net

Enjoy!

hydn 03-30-2010 06:04 AM

reserved

ps2wiz 04-05-2010 07:33 PM

Thanks for this, just switched over from memcahced. Now only if there was something we can do with vBSEO and wincache

hydn 04-06-2010 10:32 PM

I'm trying to work on that. I have it working but can't find a way to add it to the list in the cp lol

ChopSuey 05-24-2010 02:59 AM

We need WinCache installed?

Leica.Robbiani 06-12-2010 11:37 PM

Hi there,

does anyone think it's a basic necessity to use a windows server ???

Well, I think, if you never heard about FreeBSD, just try linux for some more security on your server ...

Best regards

L.R.

BoyStav 08-04-2010 03:49 PM

Quote:

Originally Posted by Leica.Robbiani (Post 2052706)
Hi there,

does anyone think it's a basic necessity to use a windows server ???

Well, I think, if you never heard about FreeBSD, just try linux for some more security on your server ...

Best regards

L.R.

I'm using Windows on all my servers.
I was tried to use a linux on my servers, it's very hard to configure, it's crosslinked with tons of other open source.

Brandon Sheley 10-26-2010 12:50 PM

Is there an easy way to test and see if we have WinCache installed?
I know I can ask my host, but didn't know if I could find out myself.

vrinteractive 11-20-2011 07:53 PM

it will show up in your phpinfo.

thanks for supporting this- seems xcache for windows quit development after 5.3.6


All times are GMT. The time now is 09:40 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01119 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete