Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #requires -version 2.0
- [CmdletBinding()]
- param (
- [string]
- $CacheName,
- [string]
- $HostName,
- [int]
- $CachePort
- )
- $CachingAssembly = join-path -path (Split-Path $MyInvocation.MyCommand.Path) -ChildPath 'Microsoft.ApplicationServer.Caching.Client.dll'
- $asm = [Reflection.Assembly]::LoadFrom($CachingAssembly)
- $server = new-object "Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint" "$HostName", $CachePort
- $config = new-object "Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration"
- $servers = @($server)
- $config.Servers = [Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint[]]$servers
- $factory = new-object 'Microsoft.ApplicationServer.Caching.DataCacheFactory' $config
- $cache = $factory.GetCache("$CacheName")
- $regions = $cache.GetSystemRegions()
- $regions | foreach-object {$cache.ClearRegion($_)}
Add Comment
Please, Sign In to add comment