{"id":18952734,"url":"https://github.com/m7moudgadallah/lfu-lru-cache","last_synced_at":"2025-09-17T23:14:47.297Z","repository":{"id":252423658,"uuid":"840149177","full_name":"m7moudGadallah/LFU-LRU-cache","owner":"m7moudGadallah","description":"Build Simple LFU and LRU Cache.","archived":false,"fork":false,"pushed_at":"2024-08-09T15:12:09.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T01:28:12.642Z","etag":null,"topics":["cpp","lfu-cache","lru-cache"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m7moudGadallah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-09T04:37:17.000Z","updated_at":"2024-08-09T15:13:49.000Z","dependencies_parsed_at":"2024-08-09T17:57:50.480Z","dependency_job_id":"c93557f2-6867-4187-9b4e-6b0f00cfc3e7","html_url":"https://github.com/m7moudGadallah/LFU-LRU-cache","commit_stats":null,"previous_names":["m7moudgadallah/lfu-lru-cache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/m7moudGadallah/LFU-LRU-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FLFU-LRU-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FLFU-LRU-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FLFU-LRU-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FLFU-LRU-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m7moudGadallah","download_url":"https://codeload.github.com/m7moudGadallah/LFU-LRU-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FLFU-LRU-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275680507,"owners_count":25508589,"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","status":"online","status_checked_at":"2025-09-17T02:00:09.119Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cpp","lfu-cache","lru-cache"],"created_at":"2024-11-08T13:34:28.854Z","updated_at":"2025-09-17T23:14:47.270Z","avatar_url":"https://github.com/m7moudGadallah.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LFU and LRU Cache\n\nThis is simple c++ implementation of LFU and LRU cache.\n\n## LFU Cache\n\nLook at the problem statement and design [here](docs/lfu-cache.md).\n\n## LRU Cache\n\nLook at the problem statement and design [here](docs/lru-cache.md).\n\n## Setup\n\n### Prerequisites\n\nEnsure you have the following tools installed on your system:\n\n1. **C++ Compiler and Build Tools**\n\n   You can install either `build-essential` (which includes `g++`) or `g++` directly.\n\n   - Option 1: Install `build-essential`:\n\n     ```sh\n     sudo apt update\n     sudo apt install build-essential\n     ```\n\n   - Option 2: Install `g++` directly:\n\n     ```sh\n     sudo apt update\n     sudo apt install g++\n     ```\n\n2. **GDB (GNU Debugger)**\n\n   ```sh\n   sudo apt install gdb\n   ```\n\n3. **CMake**\n\n   ```sh\n   sudo apt install cmake\n   ```\n\n4. **clang-format**\n\n   ```sh\n   sudo apt install clang-format\n   ```\n\n5. **Visual Studio Code** with the following extensions:\n   - C/C++ by Microsoft\n   - CMake Tools by Microsoft\n\nTo install the C/C++ extension:\n\n1. Open Visual Studio Code.\n2. Go to Extensions view by pressing `Ctrl+Shift+X`.\n3. Search for `C/C++` by Microsoft and click Install.\n\nTo install the CMake Tools extension:\n\n1. Open Visual Studio Code.\n2. Go to Extensions view by pressing `Ctrl+Shift+X`.\n3. Search for `CMake Tools` by Microsoft and click Install.\n\n## How to Compile, Run, Clean, and Debug the Project\n\n### Compile the Project\n\nTo compile the project, use the `make` command. This will generate the executable file in the `output` directory.\n\n```sh\nmake\n```\n\n### Run the Project\n\nTo run the compiled executable, use the make run command. This will compile the project (if necessary) and then run the executable.\n\n```sh\nmake run\n```\n\n### Clean the Project\n\nTo clean up the build files, including object files and the executable, use the make clean command.\n\n```sh\nmake clean\n```\n\n### Debug the Project\n\nMake sure you have installed GDB on your system. To debug the project.\n\n#### Debugging using GDB in the Terminal\n\n1. Compile the project with debugging symbols.\n\n   ```sh\n   make\n   ```\n\n2. Run `gdb` with the executable.\n\n   ```sh\n   gdb ./output/main\n   ```\n\n3. Inside gdb, set breakpoints and run the program:\n\n   ```sh\n   (gdb) break main\n   (gdb) run\n   ```\n\n4. Use typical gdb commands to step through the code, inspect variables, etc.\n\n   ```sh\n   (gdb) step\n   (gdb) print variable_name\n   ```\n\n#### Debugging using Visual Studio Code\n\nWe can also debug the project using Visual Studio Code. To do this, follow these steps:\n\n1. Open the project in Visual Studio Code.\n2. Open the file you want to debug.\n3. Set breakpoints by clicking on the left margin of the editor window.\n4. Press `F5` to start debugging.\n5. Use shortcuts like `F10` to step over, `F11` to step into, etc.\n6. Use the debug panel on the left to inspect variables, call stack, etc.\n\n## File Structure\n\nThe project has the following file structure:\n\n- `src/`: Contains the source files (`.cpp`).\n- `include/`: Contains the header files (`.hpp`).\n- `output/`: Contains the compiled executable.\n- `lib/`: Contains third-party libraries (`.a` , etc...)\n- `Makefile`: Contains the build, run, clean, and debug commands.\n- `.clang-format`: Contains the formatting style for clang-format.\n- `.vscode/`: Contains the Visual Studio Code settings and configurations for C++.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7moudgadallah%2Flfu-lru-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm7moudgadallah%2Flfu-lru-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7moudgadallah%2Flfu-lru-cache/lists"}