Check existence

Check whether a Key exists in Redis IDatabase.KeyExists(string key)Purpose: Check whether the specified key exists in Redis It returns true as long as the key exists, works for all data …

Write value

StackExchange.Redis Generic Set / Get for write‑and‑read operations Required namespaces The example below uses Set, accepts a key, byte array, and expiration duration. Notes The earlier WinForms sample used hard‑coded …

Connect to Redis

This lesson demonstrates Redis operations inside WinForms. The logic applies to other project types; WinForms is used only for demonstration purposes. After you install Redis, it runs as an independent …

Demonstrate Redis with WinForms

This section covers C# WinForms Redis cache wrapper based on StackExchange.Redis Open Visual Studio, create a WinForms project, then install dependency packages via NuGet Install Dependencies Redis Wrapper Methods Demonstrate …

Installation

Windows Redis 3.2.100 Installation and Startup Download Links Core Files After Extraction File Purpose redis‑server.exe Redis server program redis‑cli.exe Redis command‑line client tool redis.windows.conf Default configuration file redis.windows‑service.conf Dedicated config …

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 …

Escape characters and #if conditionals

Backslash Escape + #if Conditional Syntax 1. Backslash \ Escape Rules Pre‑defined variable:#set($dog = “woof woof”) VTL Code Rendered Output Explanation $dog woof woof Normal variable resolution \$dog $dog Single …

Extension methods

1. Backend Person Entity Code (C#) Set object variables in C# backend code 2. VTL Template Code & Rendering Notes 1. $pTest.getMyName() ✅ Velocity parameter‑less method call: parentheses () can …

Iterate collections

Velocity #foreach Iterate over Collections & Objects 1. Iterate over String List C# Back‑end Code Velocity Template Code Execution result: Loop through each string in the list and output with …

Comments

1. Distinction of Template Comments Syntax Type Features <!– HTML comment –> Native HTML comment Output to final webpage source code, visible when viewing page source in browser ## Single‑line …

Template reuse

1. Core Purpose The Velocity template engine achieves template reuse via #include / #parse.Common webpage sections such as page header navigation _head.htm and footer copyright _footer.htm can be extracted into …

Fundamental template syntax

1. Pass Entity Objects to Templates 1.1 PageInfo Entity Class Previously we passed simple strings, which is inefficient and hard‑to‑maintain. Wrapping data into entity objects makes code much clearer. 1.2 …

Serialization and deserialization

Let’s recap serialization from the previous section, which converts an entity object into a JSON string. Serialization Generated JSON output Deserialization Convert a JSON string back to an entity object …

Introduction

1. Introduction to Newtonsoft.Json Newtonsoft.Json (commonly known as Json.NET) is an open‑source JSON serialization/deserialization library for the .NET ecosystem 2. What is JSON JSON(JavaScript Object Notation) II. Define Entity Classes …

Other Operations

1. FlushAll() Clear Cache Key Notes 2. TryGet Safe Cache Retrieval Get() vs TryGet() Method Characteristics Use‑case mClient.Get(key) Returns null for missing keys; cannot tell apart a null‑valued cache entry …

Object Persistence

In this lesson, we will learn how to store class objects, including object storage and retrieval. This code demonstrates Memcached storing primitive types (int/bool) and custom Class objects, and highlights …