Skip to content

kuan312/redis-tinyurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyUrl with Redis

This project is aimed to practice CRUD operations using Redis. It involves setting up and interacting with a TinyURL service, where Redis serves as the backend for storing these links.

Setup Instructions

Build and run Docker containers

sudo docker compose build
sudo docker compose up -d

Access Redis inside the Docker

sudo docker exec -it tinyurl-redis sh

Start the Redis CLI

redis-cli

Basic Redis commands

Check connection

ping

Key-value Operations

  • check if a key exists:
    EXISTS key
  • set a key-value:
    SET key value
  • get value by key:
    GET key
  • delete key:
    DEL key
  • show all keys:
    KEYS *
  • set Expiry:
    EXPIRE key seconds
  • check time-to-live:
    TTL key

Hash Operations

  • set a field in a hash:
    HSET key field value
  • get a field value from a hash:
    HGET key field
  • retrieve all fields and values from hash:
    HGETALL key

Flush All Data

  • clear everything:
    FLUSHALL

Additional resource (Russian)