Introduction

Redis Basic Definition

Redis is an open‑source software written in ANSI C, network‑accessible key‑value database / storage system that supports in‑memory storage and data persistence. It provides client APIs for multiple programming languages.

  1. It belongs to NoSQL non‑relational databases;
  2. Similar to Memcached but with richer features, it makes up for many shortcomings of Memcached;
  3. Commonly used as a supplementary caching solution for relational databases such as MySQL.

Supported Data Types

  • String: String type
  • List: Doubly‑linked list
  • Set: Unordered collection
  • zset(sorted set): Sorted collection
  • Hash: Hash structure (similar to Map)

Memcached only supports string type, which is one of the most typical differences between them.

Features

  1. Multi‑language client support
    Official SDKs are available for Java, C/C++, C#, PHP, JavaScript, Python, Ruby, Perl and many other languages for easy integration.
  2. Master‑slave synchronization
    Supports master‑slave replication for off‑site data backup and read‑write separation to improve service availability.
  3. High performance
    Data resides mainly in memory for extremely fast read and write performance, widely used as a distributed cache.
  4. Data persistence
    In‑memory data can be persisted to disk so data will not be fully lost after restart (Memcached has no persistence by default).

Background

The early Redis project was funded, developed and maintained by VMware.

We will demonstrate Redis usage with a simple WinForm(C#) Redis client demo, an introductory sample showing how C# connects to Redis.

  • Set key‑value pairs
  • Get value by key

Brief comparison: Redis vs Memcached

FeatureRedisMemcached
Data Types5 basic structuresString only
PersistenceSupports RDB/AOF persistenceNo persistence support
Master‑Slave ReplicationSupportedNo native support
Memory EvictionMultiple eviction policiesLRU eviction

Introduction

Leave a Reply

Your email address will not be published. Required fields are marked *