Admin: Realtime cache setup
Overview
In order for RPI realtime decisions to be used, a caching mechanism must be made available, and configuration performed to ensure that the RPI Realtime application can make use of the same. The following sections describe how to configure RPI Realtime to use each of these.
Setup of each cache technology is beyond the scope of this documentation.
Cassandra cache configuration
In the RPI Realtime appsettings.json
file’s CacheSettings
section, add the following:
{
"Name": "Default",
"Assembly": "Redpoint.Resonance.CassandraCachehe",
"Class": "Redpoint.CassandraCache.CassandraCacheHandler",
"Settings": [
{
"Key": "Keyspace",
"Value": "rpi",
"Values": null
},
{
"Key": "ContactPoints",
"Value": "server1,server2",
"Values": null
},
{
"Key": "Username",
"Value": "CassandraUser",
"Values": null
},
{
"Key": "Password",
"Value": "Password",
"Values": null
}
]
}
MongoDB cache configuration
In the RPI Realtime appsettings.json
file’s CacheSettings
section, add the following:
{
"Name": "Default",
"Assembly": "Redpoint.Resonance.MongoDBCache",
"Class": "Redpoint.Resonance.MongoDBCache.MongoDBCacheHandler",
"Settings": [
{
"Key": "Server",
"Value": "Server"
},
{
"Key": "Port",
"Value": "Port"
},
{
"Key": "Database",
"Value": "Database"
},
{
"Key": "CollectionName",
"Value": "CollectionName"
},
{
"Key": "IDasKeyEnabled",
"Value": true
}
]
}
The IDasKeyEnabled
parameter, which, when enabled (the recommended setting), ensures records are written and retrieved from MongoDB using the native Mongo _id
field instead of "Key"
field.
The following Settings can be used to configure Partition Key functionality:
PartitionKeyEnabled
(default value =false
)PartitionKeys
(default valuesFieldName1
andFieldName2
)
The following additional parameters are also supported at MongoDB cache:
Ssl
ReplicaSet
ConnectionString
, for example:
{
"Key": "ConnectionString",
"Value": "mongodb://localhost:27017"
}
If a ConnectionString
is provided, the Server
, Port
, Username
, Password
, ssl
, and ReplicaSet
parameters are ignored. Provision of the Database
parameter is mandatory; CollectionName
and MessageHistoryCollectionName
are optional.
SQL server cache configuration
When using the RPI SQL Server native cache provider, scripts to set up SQL Server in-memory cache tables are available in the following deployment files folder:
\DeploymentFiles\SQL Server\Useful Scripts\Realtime In Memory Cache Setup.sql
Notes are provided therein, which should be read before executing the scripts.
An example SQL Server cache configuration section from appsettings.json
is provided below:
{
"Name": "InMemorySQL",
"Assembly": "RedPoint.Resonance.Web.Shared",
"Class": "RedPoint.Resonance.Web.Shared.Cache.SQLServerCache",
"Settings": [
{
"Key": "ConnectionString",
"Value": "Data Source=localhost;Initial Catalog=AdventureWorksDW;Integrated Security=True"
}
]
}
Google BigTable cache configuration
Able to support Google BigTable for Realtime API Cache provider.
The following settings must be configured in Realtime API appsettings.json
:
{
"Name":"GoogleBigTable",
"Assembly":"RedPoint.Google.Server",
"Class":"RedPoint.Google.Server.GoogleBigTableCache.GoogleBigTableCacheHandler",
"Settings":[
{
"Key":"ProjectId",
"Value":""
},
{
"Key":"InstanceId",
"Value":""
}
]
}
Redis configuration
This section describes how to configure the RPI Realtime website to utilize the Redis caching mechanism.
In the RPI Realtime appsettings.json
file’s CacheSettings
section, add the following:
{
"Name": "Redis",
"Assembly": "Redpoint.Resonance.RedisCache",
"Class": "Redpoint.Resonance.RedisCache.RedisCacheHandler",
"Settings": [
{
"Key": "IPAddress",
"Value": "127.0.0.1"
},
{
"Key": "DisableMGET",
"Value": true
}
]
}
The DisableMGET
setting is used to toggle whether the cache provider will use multi-key operations.
Azure Redis cache configuration
This section describes how to configure the RPI Realtime website to utilize the Windows Azure Redis caching mechanism.
In the RPI Realtime appsettings.json
file’s CacheSettings
section, add the following:
{
"Name": "AzureRedis",
"Assembly": "RedPoint.Azure.Server",
"Class": "RedPoint.Azure.Server.AzureRedisCache.AzureRedisCacheHandler",
"Settings": [
{
"Key": "ConnectionString",
"Value": "_azure connection string_"
},
{
"Key": "DisableMGET",
"Value": true
}
]
}
The DisableMGET
setting is used to toggle whether the cache provider will use multi-key operations.
CosmosDB cache configuration
An example CosmosDB cache configuration section from appsettings.json
is provided below:
{
"Name": "AzureCosmosDB",
"Assembly": "RedPoint.Resonance.DocumentDBCache",
"Class": "RedPoint.Resonance.DocumentDbCache.DocumentDBCacheHandler",
"Settings": [
{
"Key": "DatabaseId",
"Value": "<DATABASE ID HERE>"
},
{
"Key": "ConnectionString",
"Value": "<CONNECTIONSTRING HERE>"
},
{
"Key": "ContainerName",
"Value": "<NAME>"
}
]
}
The ContainerName
setting will be used as the table name to be created in CosmosDB. Its id
column will be used as the PartitionKey
(indicated by a prefix '/
' in the Azure portal).