Skip to content

Youbi-Dev/Caching-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🗂️ Caching System Project

A simple caching system built with PHP and JSON, featuring a user-friendly web interface.

📋 Project Overview

This system allows you to temporarily store data in server memory with expiration times (TTL). Perfect for beginners learning web development and APIs.

✨ Features

  • ✅ Store data with time-to-live (TTL) expiration
  • ✅ Simple RESTful API
  • ✅ Arabic user-friendly web interface
  • ✅ JSON file-based storage
  • ✅ Basic CRUD operations support

📁 File Structure

│ ├── 📄 index.php # Main user interface ├── 📄 api.php # API endpoints ├── 📄 cache.php # Caching system core ├── 📄 cache_data.json # Data storage file (auto-generated)

🚀 Installation & Setup

Prerequisites

  • Web server (XAMPP, WAMP, or MAMP)
  • PHP 7.0 or newer
  • Modern web browser

Setup Steps

  1. Copy all files to your web server directory: C:\xampp\htdocs\caching-system\
  2. Start your web server
  3. Open your browser and navigate to: http://localhost/caching-system/index.php

🔧 Usage

Via Web Interface

  1. Open index.php in your browser
  2. Use the buttons to manage data:
  • Add Data: Fill fields and click "Save Data"
  • Retrieve Data: Enter key and click "Retrieve Data"
  • Update Data: Fill fields and click "Update Data"
  • Delete Data: Enter key and click "Delete Data"

Via API (Using Postman)

1. Create Data (POST)

POST http://localhost/caching-system/api.php
Content-Type: application/json

{
 "key": "username",
 "value": "Ahmed",
 "ttl": 60
}

#### 2. Retrieve Data (GET)
GET http://localhost/caching-system/api.php?key=username

#### 3. Update Data (PUT)

PUT http://localhost/caching-system/api.php
Content-Type: application/json

{
    "key": "username",
    "value": "Ahmed Updated",
    "ttl": 120
}

#### 4. Delete Data (DELETE)

DELETE http://localhost/caching-system/api.php?key=username

{
    "message": "Key username set with value Ahmed"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors