{"id":25621095,"url":"https://github.com/kruceo/unicache","last_synced_at":"2025-02-22T08:34:04.980Z","repository":{"id":259527451,"uuid":"864060072","full_name":"Kruceo/UniCache","owner":"Kruceo","description":"A http (in memory) caching service that sits between the client and the main service ","archived":false,"fork":false,"pushed_at":"2024-10-24T20:24:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-26T07:38:17.858Z","etag":null,"topics":["cache","http","server","service"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kruceo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-27T12:19:53.000Z","updated_at":"2024-10-24T20:24:34.000Z","dependencies_parsed_at":"2024-10-26T15:51:52.807Z","dependency_job_id":null,"html_url":"https://github.com/Kruceo/UniCache","commit_stats":null,"previous_names":["kruceo/unicache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kruceo%2FUniCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kruceo%2FUniCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kruceo%2FUniCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kruceo%2FUniCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kruceo","download_url":"https://codeload.github.com/Kruceo/UniCache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240149223,"owners_count":19755716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","http","server","service"],"created_at":"2025-02-22T08:34:03.773Z","updated_at":"2025-02-22T08:34:04.973Z","avatar_url":"https://github.com/Kruceo.png","language":"Go","readme":"# UniCache\n\n**UniCache** is an in-memory caching service that acts as an intermediary between the client and a backend server. It improves system efficiency by temporarily storing responses, reducing the load on the backend and speeding up responses to clients.\n\n## Overview\n\nUniCache functions as a middle layer between the client and the backend. When the client sends a request, UniCache checks if the response is already cached. If so, it returns the cached response. Otherwise, it forwards the request to the backend, stores the response, and returns it to the client.\n\n```cmd\nClient -\u003e UniCache -\u003e Backend\n```\n\nThis process reduces the need for repeated queries to the backend, improving overall system performance.\n\n## Example Workflow\n\n### Before using UniCache\n\nThe client would make a direct request to the backend:\n\n```bash\nGET http://192.168.0.100:8080/v1/product\n```\n\n### After adding UniCache\n\nWith UniCache acting as an intermediary, the client sends the request to the cache, which decides whether to forward it to the backend:\n\n```bash\nGET http://192.168.0.50:3030/v1/product\n```\n\nIf the response is already cached, UniCache returns it directly. Otherwise, the request is forwarded to the backend at `http://192.168.0.100:8080/v1/product`, and the response is stored for future use.\n\n## Configuration\n\n### Step 1: Build the Project\n\nFirst, compile the project by running the following command in the root directory:\n\n```bash\ngo build\n```\n\nThis will generate the executable `unicache`.\n\n### Step 2: Configure UniCache\n\nAfter compiling, you need to configure UniCache to point to the correct backend. This is done through environment variables:\n\n- `POINT_ADDRESS`: The IP address of the backend.\n- `POINT_PORT`: The port on which the backend is listening.\n- `POINT_PROTOCOL`: The protocol (e.g., `http` or `https`) used by the backend.\n\nExample configuration for a backend located at `192.168.0.100:8080`:\n\n```bash\nPOINT_ADDRESS=192.168.0.100 POINT_PORT=8080 POINT_PROTOCOL=http ./unicache\n```\n\nThis sets up UniCache to forward requests to the backend running at `192.168.0.100` on port `8080`.\n\n#### **Other Configurations**\n\n```python\nCACHE_TIMEOUT=40    # 40 seconds\nCACHE_CLEANER_INTERVAL=60    # 60 seconds\nEXCLUDED_PATHS=/authentication,/v1/auth    # don't cache these paths\n```\n\n### Step 3: Running the UniCache\n\nOnce configured, you can start UniCache. Now, clients can send requests to `192.168.0.50:3030`, where UniCache is running, and it will decide whether to respond from the cache or retrieve the response from the backend.\n\n## Benefits\n\n- **Improved Performance**: By caching responses in memory, UniCache reduces the backend's workload.\n- **Reduced Latency**: Response time is decreased for cached requests.\n- **Scalability**: Fewer requests to the backend allow the system to scale more effectively.\n\n## Contribution\n\nContributions and suggestions are always welcome! If you have any ideas for improvement or encounter issues, feel free to open an issue or submit a pull request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkruceo%2Funicache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkruceo%2Funicache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkruceo%2Funicache/lists"}