Showing posts with label Cache. Show all posts
Showing posts with label Cache. Show all posts

Monday, 25 March 2013

HTML5 Application Cache.

Are you working with HTML5, then take a quick look at this post that explains how to develop a offline web project using HTML5 application cache. Most of the latest browsers have caching mechanisms, this gives three advantages reducing server load, increases web page speed and office access specially for gaming website.

HTML5 Application Cache.

Read more »
Share:

Saturday, 15 December 2012

App Fabric Cache Configuration Scripts

1. Script to Update the Max Buffer Size of AppFabric Cache

AppFabric Cache has a default max buffer size of 8MB. There are certain scenario where we may need this to modify to satisfy our requirements Find below the script to configure the AppFabric Cache Buffer Size. Script below can be used to increase or decrease this preconfigured size.

#Command Line powershell ./UpdateAppFabricCacheBufferSize.ps1 15000000 



#Manual Step before we run any script on Poweshell : Set-ExecutionPolicy Unrestricted



 



Param([int]$maxBufferSize)   



Import-Module DistributedCacheAdministration, DistributedCacheConfiguration   



Function UpdateBufferSizeInConfig ([string]$configFilename, [int]$maxBufferSize) 



{     



    $xml = New-Object XML     



    $xml.Load($configFilename)     



    $transportProperties = $xml.configuration.dataCache.advancedProperties.transportProperties     



    if ($transportProperties -eq $NULL) 



    {       



        $transportProperties = $xml.CreateElement("transportProperties")     



    }     



    $transportProperties.SetAttribute("maxBufferSize", "$maxBufferSize")     



    $xml.configuration.dataCache.advancedProperties.appendChild($transportProperties)     



    $xml.Save($configFilename) 



}   



$tempConfigLocation = "c:\config.xml"  



Use-CacheCluster



Export-CacheClusterConfig -File $tempConfigLocation  



UpdateBufferSizeInConfig $tempConfigLocation $maxBufferSize  



Stop-CacheCluster



Import-CacheClusterConfig -File $tempConfigLocation -Force



Start-CacheCluster




2. Script to configure the Named Cache and than Add Users in allowed client account list.



 



#To add a name cahce and windows account to the Cluster.



 



function CreateNewCache([string]$NewCacheName)



{



    New-Cache -CacheName $NewCacheName -Secondaries 1 -Force



    write-host "Name Cache $NewCacheName is created" -foregroundcolor green



    write-host "The cache config info :" -foregroundcolor green



    Get-CacheConfig $NewCacheName



}



 



function AddUser([string]$DomainnameUsername)



{



    Grant-CacheAllowedClientAccount -Account "$DomainnameUsername"



    write-host "$DomainnameUsername is added" -foregroundcolor green



    write-host "The list of AllowedClientAccounts below:" -foregroundcolor green



    Get-CacheAllowedClientAccounts



}



 



Write-host "Number of Arguments :" $args.Length;



if($args.Length -gt 1)



{



    CreateNewCache($args[0])



    AddUser($args[1])



}



 



if($args.Length -eq 1)



{



    if($args[0] -like "*\*")



    {



        AddUser($args[0])



    }



    else



    {



        CreateNewCache($args[0])



    }



}



 



 



 



 





Both the scripts provided above are very simple to understand and use through poweshell command line, and used for very specific operation. You can enhance these scripts to even configure advanced settings of Windows AppFabric.

Share: