{"id":21946741,"url":"https://github.com/storozhukbm/pcache","last_synced_at":"2025-04-22T22:25:26.421Z","repository":{"id":57543801,"uuid":"295254680","full_name":"storozhukBM/pcache","owner":"storozhukBM","description":"Cache that tries to keep data local for the goroutine and reduce synchronization overhead, but keep it is safe for concurrent use.","archived":false,"fork":false,"pushed_at":"2020-10-18T12:36:40.000Z","size":26,"stargazers_count":45,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-19T03:53:22.311Z","etag":null,"topics":["cache","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/storozhukBM.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}},"created_at":"2020-09-13T23:15:54.000Z","updated_at":"2022-12-02T23:02:15.000Z","dependencies_parsed_at":"2022-08-27T18:51:56.293Z","dependency_job_id":null,"html_url":"https://github.com/storozhukBM/pcache","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storozhukBM%2Fpcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storozhukBM%2Fpcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storozhukBM%2Fpcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storozhukBM%2Fpcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/storozhukBM","download_url":"https://codeload.github.com/storozhukBM/pcache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333037,"owners_count":21413311,"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","go","golang"],"created_at":"2024-11-29T04:34:43.550Z","updated_at":"2025-04-22T22:25:26.379Z","avatar_url":"https://github.com/storozhukBM.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PCache  [![Build Status](https://github.com/storozhukBM/pcache/workflows/build/badge.svg)](https://github.com/storozhukBM/pcache/actions)  [![Go Report Card](https://goreportcard.com/badge/github.com/storozhukBM/pcache)](https://goreportcard.com/report/github.com/storozhukBM/pcache) [![codecov](https://codecov.io/gh/storozhukBM/pcache/branch/master/graph/badge.svg)](https://codecov.io/gh/storozhukBM/pcache) [![PkgGoDev](https://pkg.go.dev/badge/github.com/storozhukBM/pcache)](https://pkg.go.dev/github.com/storozhukBM/pcache)\n`PCache` Cache that tries to keep data local for the goroutine and reduce synchronization overhead but keep it is safe for concurrent use.\n\n`PCache` does its best to cache items inside and do as little synchronization as possible,\n but since it is cache, there is no guarantee that `PCache` won't evict your item after Store.\n \n Due to its implementation specifics, in some edge cases, \n  PCache can potentially restore previously-stored items after eviction, so please take into account that\n  **it is possible and valid to observe \"old\" values of the specific key**. \n  While this behavior is unconventional, it is totally usable for:\n   - immutable key-value pairs\n   - keys that will always resolve into the same value\n   - cases when it is easy for you to identify that\n    the value is old and drop it or set to the new one\n\n`PCache` eviction policy is based on GC cycles, so it can evict all items from time to time.\n\nYou can limit the size of the cache per goroutine, and `PCache` evicts random items\n if I goroutine local cache achieves maxSizePerGoroutine size.\n \nYou can also use PCache as a superfast, tiny cache in front of another globally synchronized cache.\n\n## How to use it\nYou can import it as a library via Go modules or copy-paste `pcache.go` file\n it to your project and specify exact types that you need for your cache\n to achieve even better performance.\n\n## Benches\n\n\u003cimg width=\"1609\" alt=\"Screenshot 2020-10-17 at 20 13 55\" src=\"https://user-images.githubusercontent.com/3532750/96351739-4e142480-10b5-11eb-9509-78da3c9ef163.png\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstorozhukbm%2Fpcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstorozhukbm%2Fpcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstorozhukbm%2Fpcache/lists"}