键-值存储
一句话解释
键-值存储是 NoSQL 数据库哪里每个项 是唯一键 mapped 到值 — 否 Schema, 否关系.
用大白话说
A key-value store is the simplest type of NoSQL database. Every piece of data is stored as a pair: a unique key and a value. You can set a value by key, get a value by key, and delete a key — that is the core API.
For example:
SET 用户:1:name "Ada"→ stores "Ada" under the key "用户:1:name"GET 用户:1:name→ returns "Ada"DEL 用户:1:name→ removes the key
The value can be a string, number, blob, or (in richer stores like Redis) a list, set, or hash. The database does not understand the contents of the value — it just stores and retrieves it by key.
Key-value stores are extremely fast and simple. They are great for caching, session storage, and configuration. They are not good for complex queries, joins, or ad-hoc filtering — you can only look up by exact key. Redis, DynamoDB, and Memcached are popular key-value stores.
示例
# Redis key-value operations
SET session:abc123 "user=42"
GET session:abc123 # → "user=42"
EXISTS session:abc123 # → 1 (true)
DEL session:abc123 # → 1 (deleted)
EXISTS session:abc123 # → 0 (false)基础键-值操作: 设置值, 获取它 通过键, 检查 existence, and 删除.
相关术语
相关资源
相关课程
- NoSQL Overview
学习关于键-值存储 and other NoSQL 类型.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。