Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons

Reply
 
Thread Tools
Datastore cache to WinCache - boost your vBulletin Details »»
Datastore cache to WinCache - boost your vBulletin
Version: 1.02, by hydn hydn is offline
Developer Last Online: Sep 2013 Show Printable Version Email this Page

Category: Board Optimization - Version: 3.8.x Rating:
Released: 03-21-2010 Last Update: Never Installs: 14
Code Changes  
No support by the author.

Also see: Wincache for vb 4.0.2

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 IIS server. Use at your own risk!

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

Prerequisites
  • a working php installation
  • a working vBulletin 3.8.x 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($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);
                }
}
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!

Screenshots

File Type: jpg wincache_datastore_stats.jpg (199.8 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-22-2010, 01:26 AM
hydn hydn is offline
 
Join Date: Oct 2005
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reserved.
Reply With Quote
  #3  
Old 03-22-2010, 10:02 AM
puertoblack2003's Avatar
puertoblack2003 puertoblack2003 is offline
 
Join Date: Aug 2005
Location: Philadelphia
Posts: 1,073
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this also works with Apache on windows
Reply With Quote
  #4  
Old 03-22-2010, 01:45 PM
hydn hydn is offline
 
Join Date: Oct 2005
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes it should. I have not tested and thus don't like to tell others to install something without knowing that it works
Reply With Quote
  #5  
Old 03-22-2010, 06:38 PM
Daryn Daryn is offline
 
Join Date: Nov 2008
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got this installed and it seems to be working. I don't think I've seen vB this fast before.

Just a note though, your code for class_datastore has the closing ?> at the end of it, that would end up being a double close if you pasted it as is.
Reply With Quote
  #6  
Old 03-23-2010, 02:06 PM
AzzidReign's Avatar
AzzidReign AzzidReign is offline
 
Join Date: Apr 2006
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is great! Thx.
Reply With Quote
  #7  
Old 03-27-2010, 10:12 AM
hollyboy's Avatar
hollyboy hollyboy is offline
 
Join Date: Mar 2004
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there a similar mod for linux server?
Reply With Quote
  #8  
Old 03-28-2010, 03:16 AM
hydn hydn is offline
 
Join Date: Oct 2005
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hollyboy View Post
is there a similar mod for linux server?
wincache is for windows servers only.
Reply With Quote
  #9  
Old 03-28-2010, 03:21 AM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LinCache would be good.
Reply With Quote
  #10  
Old 03-28-2010, 11:15 PM
ps2wiz ps2wiz is offline
 
Join Date: Apr 2005
Posts: 217
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work in VB4?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:23 AM.


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.05532 seconds
  • Memory Usage 2,315KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete