How to clear all objects in SOSS store?

#1
Please provide sample code or power shell command to clear all objects in SOSS store(both in default and named cache regions). I was using Clear-Store PS command but its throwing exception.
Refer attachment for error./storage/temp/56-capture.png
 

admin

Administrator
#1
Using the 'SOSS Powershell Administration' shortcut or by importing the 'SossAdministration' PowerShell module directly into PowerShell, you can use the PowerShell cmdlet 'Clear-AllObjects' to clear all objects from the ScaleOut StateServer store.

You can also clear all objects from the store by using the soss.exe command line utility to execute the command, "soss.exe clear", or alternatively the SOSS Console by selecting the 'Store' drop-down menu and clicking the "Clear Store" option.
 

markw

Administrator
Staff member
#5
Hi Satish,

You can use an instance of a NamedCache object in a Powershell script--call the Remove(key) method to delete a specific object. For example:

Code:
# Sample script: Remove-Scaleout-Object.ps1

Param
(
    [parameter(Mandatory=$true)]
    [String] $Namespace,
    [parameter(Mandatory=$true)]
    [String] $Key
)

# Load ScaleOut library (version 2.0.0.0 will also work if PS runs under an older .NET runtime):
Add-Type -AssemblyName "soss_namedcache, Version=5.0.0.0, Culture=neutral, PublicKeyToken=a1ec0b86f746a476"

$nc = [Soss.Client.CacheFactory]::GetCache($Namespace)
$nc.Remove($Key)
Then invoke the script with the two arguments (the object's namespace and key):
Code:
.\Remove-Scaleout-Object.ps1 -Namespace "Customers" -Key "Customer 1234"
 
Top