Guest User

Untitled

a guest
Nov 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #requires -version 2.0
  2. [CmdletBinding()]
  3. param (
  4. [string]
  5. $CacheName,
  6.  
  7. [string]
  8. $HostName,
  9.  
  10. [int]
  11. $CachePort
  12. )
  13.  
  14. $CachingAssembly = join-path -path (Split-Path $MyInvocation.MyCommand.Path) -ChildPath 'Microsoft.ApplicationServer.Caching.Client.dll'
  15. $asm = [Reflection.Assembly]::LoadFrom($CachingAssembly)
  16.  
  17. $server = new-object "Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint" "$HostName", $CachePort
  18. $config = new-object "Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration"
  19. $servers = @($server)
  20. $config.Servers = [Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint[]]$servers
  21.  
  22. $factory = new-object 'Microsoft.ApplicationServer.Caching.DataCacheFactory' $config
  23. $cache = $factory.GetCache("$CacheName")
  24.  
  25. $regions = $cache.GetSystemRegions()
  26. $regions | foreach-object {$cache.ClearRegion($_)}
Add Comment
Please, Sign In to add comment