{"id":24749985,"url":"https://github.com/abhigyan126/sieve","last_synced_at":"2025-09-04T20:56:04.841Z","repository":{"id":273554862,"uuid":"920109242","full_name":"Abhigyan126/SIEVE","owner":"Abhigyan126","description":"A C implementation of the SIEVE cache eviction algorithm, based on the research paper (https://junchengyang.com/publication/nsdi24-SIEVE.pdf)","archived":false,"fork":false,"pushed_at":"2025-01-22T17:25:45.000Z","size":39,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T23:08:07.632Z","etag":null,"topics":["c","c-library","sieve-cache"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/Abhigyan126.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,"zenodo":null}},"created_at":"2025-01-21T15:25:26.000Z","updated_at":"2025-05-17T14:50:02.000Z","dependencies_parsed_at":"2025-06-22T23:08:10.317Z","dependency_job_id":"a5e33a99-1fca-424b-9684-e6295188d9ec","html_url":"https://github.com/Abhigyan126/SIEVE","commit_stats":null,"previous_names":["abhigyan126/sieve"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Abhigyan126/SIEVE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhigyan126%2FSIEVE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhigyan126%2FSIEVE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhigyan126%2FSIEVE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhigyan126%2FSIEVE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abhigyan126","download_url":"https://codeload.github.com/Abhigyan126/SIEVE/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhigyan126%2FSIEVE/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262937268,"owners_count":23387550,"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":["c","c-library","sieve-cache"],"created_at":"2025-01-28T08:54:07.532Z","updated_at":"2025-07-01T09:36:49.387Z","avatar_url":"https://github.com/Abhigyan126.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SIEVE Cache Implementation\n\nA C implementation of the SIEVE cache eviction algorithm, based on the research paper (https://junchengyang.com/publication/nsdi24-SIEVE.pdf)\n\n## Overview\n\nThis project implements the SIEVE cache eviction algorithm, which offers:\n- Simpler implementation than LRU\n- Better efficiency than many state-of-the-art algorithms\n- Superior scalability with no locking required for cache hits\n- Potential to be used as a cache primitive like FIFO and LRU\n\n## Implementation\n\nThe cache is implemented with these key components:\n- Fixed-size array of cache entries\n- Each entry contains:\n  - Key (string)\n  - Value (integer)\n  - Visited flag\n-  hand pointer for eviction\n- No complex data structures required\n\nFlowchart\n\n```mermaid\n%%{init: {'theme': 'black', 'themeVariables': { 'fontSize': '16px'}, \"securityLevel\": \"loose\"}}%%\ngraph TD\n    A[Cache Operation] --\u003e B{Operation Type}\n    \n    B --\u003e|Insert| C{Key Exists?}\n    C --\u003e|Yes| D[Update Value]\n    C --\u003e|No| E{Cache Full?}\n    E --\u003e|Yes| F[Eviction Process]\n    E --\u003e|No| G[Insert New Entry]\n    \n    F --\u003e H{Check Current Hand}\n    H --\u003e|Visited=True| I[Set Visited=False]\n    I --\u003e J[Move Hand]\n    J --\u003e H\n    H --\u003e|Visited=False| K[Evict Entry]\n    K --\u003e G\n    \n    B --\u003e|Get| L{Find Key}\n    L --\u003e|Found| M[Mark Visited \u0026 Return]\n    L --\u003e|Not Found| N[Return NULL]\n    \n    subgraph Cache Structure\n        O[Node Array] --\u003e P[Key]\n        O --\u003e Q[Value]\n        O --\u003e R[Visited Flag]\n    end\n```\n### Building the Project\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n### Usage\n\n```c\n// Create a cache\nCache *cache = create_cache(size);\n\n// Insert a key-value pair\ninsert(cache, \"key\", value);\n\n// Retrieve a value\nint *value = get(cache, \"key\");\n\n// Free the cache\nfree_cache(cache);\n```\n\n## Directory Structure\n\n```\nsieve/\n├── CMakeLists.txt\n├── include/\n│   └── sieve.h\n├── src/\n│   └── sieve.c\n└── tests/\n    └── test.c\n```\n\n## Algorithm Details\n\nThe implementation follows the SIEVE algorithm's clock-based approach:\n1. The hand moves through the cache\n2. If it finds an unvisited entry, that entry is evicted\n3. If an entry is visited, its visited flag is cleared and the hand moves on\n4. If all entries are visited, the hand will eventually return to evict the first entry it finds\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhigyan126%2Fsieve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhigyan126%2Fsieve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhigyan126%2Fsieve/lists"}