Redis is a key / value store on steroids, not a relational database.
How to ensure data integrity? Are there integrity methods?
Redis supports a variety of save options, from "unsafe but very efficient" to "safe but not very effective." See Additional Information at:
Redis also supports a master-slave replication mechanism to protect data in the event of a complete node failure.
A single instance of Redis always ensures data consistency (in the sense of the CAP theorem, not in the sense of ACID).
Does Redis have a primary key? or alternatives
Redis is a key / value store. All items have a key. There is no concept of a primary or secondary key.
Foreign key? Referential Integrity?
These are relational concepts. Redis is not a relational database. A foreign key means nothing (no table concept with Redis). Redistribution is not supported by Redis and must be performed by the client application.
How to implement ACID properties?
They should not be implemented since Redis is not a transactional database. Redis has no rollback mechanism. However, in terms of ACID properties:
- Atomicity and consistency can be guaranteed for a group of commands from the server side of the Lua script
- Isolation is always guaranteed at the command level and can also be guaranteed for a group of commands using the MULTI / EXEC block or Lua script
- Durability can be guaranteed by activating AOF (with systematic fsync)
source share