Redis Flashcards

1
Q

Azure Cache for Redis tiers

A

Tier
Basic
Standard
Premium
Enterprise
Enterprise Flash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Basic

A

An OSS Redis cache running on a single virtual machine (VM). This tier has no service-level agreement (SLA) and is ideal for development/test and noncritical workloads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Standard

A

An OSS Redis cache running on two VMs in a replicated configuration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Premium

A

High-performance OSS Redis caches. This tier offers higher throughput, lower latency, better availability, and more features. Premium caches are deployed on more powerful VMs compared to the VMs for Basic or Standard caches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Enterprise

A

High-performance caches powered by Redis Labs’ Redis Enterprise software. This tier supports Redis modules including RediSearch, RedisBloom, and RedisTimeSeries. Also, it offers even higher availability than the Premium tier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Enterprise Flash

A

Cost-effective large caches powered by Redis Labs’ Redis Enterprise software. This tier extends Redis data storage to nonvolatile memory, which is cheaper than DRAM, on a VM. It reduces the overall per-GB memory cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Redis cache Name

A

The Redis cache needs a globally unique name. The name has to be unique within Azure because it’s used to generate a public-facing URL to connect and communicate with the service.

The name must be between 1 and 63 characters, composed of numbers, letters, and the ‘-‘ character. The cache name can’t start or end with the ‘-‘ character, and consecutive ‘-‘ characters aren’t valid.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Cache type

A

The tier determines the size, performance, and features that are available for the cache.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Clustering support

A

With the Premium, Enterprise, and Enterprise Flash tiers you can implement clustering to automatically split your dataset among multiple nodes. To implement clustering, you specify the number of shards to a maximum of 10. The cost incurred is the cost of the original node, multiplied by the number of shards.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Accessing the Redis instance

A

ping Ping the server. Returns PONG.

set [key] [value] Sets a key/value in the cache. Returns “OK” on success.

get [key] Gets a value from the cache.

exists [key] Returns ‘1’ if the key exists in the cache, ‘0’ if it doesn’t.

type [key] Returns the type associated to the value for the given key.

incr [key] Increment the given value associated with key by ‘1’. The value must be an integer or double value. This returns the new value.

incrby [key] [amount] Increment the given value associated with key by the specified amount. The value must be an integer or double value. Returns the new value.

del [key] Deletes the value associated with the key.

flushdb Delete all keys and values in the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Adding an expiration time to values

A

expire counter 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Connecting to your Redis cache with StackExchange.Redis

A

[cache-name].redis.cache.windows.net:6380,password=[password-here],ssl=True,abortConnect=False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Creating a connection

A

You create a ConnectionMultiplexer instance using the static ConnectionMultiplexer.Connect or ConnectionMultiplexer.ConnectAsync method, passing in either a connection string or a ConfigurationOptions object.

using StackExchange.Redis;

var connectionString = “[cache-name].redis.cache.windows.net:6380,password=[password-here],ssl=True,abortConnect=False”;
var redisConnection = ConnectionMultiplexer.Connect(connectionString);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Accessing a Redis database

A

The IDatabase type represents the Redis database. You can retrieve one using the GetDatabase() method:

IDatabase db = redisConnection.GetDatabase();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

example of storing/getting a key/value in the cache:

A

bool wasSet = db.StringSet(“favorite:flavor”, “i-love-rocky-road”);

string value = db.StringGet(“favorite:flavor”);
Console.WriteLine(value); // displays: ““i-love-rocky-road””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Executing other commands

A

The IDatabase object has an Execute and ExecuteAsync method that can be used to pass textual commands to the Redis server. For example:

var result = db.Execute(“ping”);
Console.WriteLine(result.ToString()); // displays: “PONG”

17
Q

Create an Azure Cache for Redis instance

A

Create an Azure Cache for Redis instance by using the az redis create command.

redisName=az204redis$RANDOM
az redis create –location <myLocation> \
--resource-group az204-redis-rg \
--name $redisName \
--sku Basic --vm-size c0</myLocation>

18
Q
A