{"id":14956045,"url":"https://github.com/chaudhary/mongoid_cache_store","last_synced_at":"2026-01-20T13:01:40.896Z","repository":{"id":56884329,"uuid":"104590820","full_name":"chaudhary/mongoid_cache_store","owner":"chaudhary","description":null,"archived":false,"fork":false,"pushed_at":"2017-11-24T14:03:55.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T23:41:41.152Z","etag":null,"topics":["caching","mongoid","ruby-gem","rubyonrails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/chaudhary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-23T18:44:37.000Z","updated_at":"2017-09-24T16:54:22.000Z","dependencies_parsed_at":"2022-08-21T00:20:20.797Z","dependency_job_id":null,"html_url":"https://github.com/chaudhary/mongoid_cache_store","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/chaudhary/mongoid_cache_store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaudhary%2Fmongoid_cache_store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaudhary%2Fmongoid_cache_store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaudhary%2Fmongoid_cache_store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaudhary%2Fmongoid_cache_store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaudhary","download_url":"https://codeload.github.com/chaudhary/mongoid_cache_store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaudhary%2Fmongoid_cache_store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["caching","mongoid","ruby-gem","rubyonrails"],"created_at":"2024-09-24T13:12:13.900Z","updated_at":"2026-01-20T13:01:40.879Z","avatar_url":"https://github.com/chaudhary.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoidCacheStore\n\nMongoidCacheStore helps in reducing the number of queries to the database.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'mongoid_cache_store'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install mongoid_cache_store\n\n## Usage\nFor ex:\n```ruby\nclass User\n  include Mongoid::Document\n  belongs_to :image, class_name: UserImage, inverse_of: nil\n  # other user fields goes here\nend\n\nclass UserImage\n  include Mongoid::Document\n\n  # image field goes here\nend\n```\n\nNow, in order to display list of users on a listing page, we need data for users including their image url.\nAccessing image method again \u0026 again will increase number of queries.\n\n```ruby\ncache_store = CacheStore.new.cache_docs(user_ids, User, [{field_name: 'image_id', klass: UserImage}])\nuser = cache_store.document(user_id, User)\nuser_image = cache_store.document(user.image_id, UserImage)\n```\n\nTo fetch all documents of a particular klass cached.\n```ruby\ncache_store = CacheStore.new.cache_docs(user_ids, User, [{field_name: 'image_id', klass: UserImage}])\nusers = cache_store.sorted_documents(User)\n```\n\nTo fetch list of documents for a list of ids ordered as per ids list.\n```ruby\ncache_store = CacheStore.new.cache_docs(user_ids, User, [{field_name: 'image_id', klass: UserImage}])\nusers = cache_store.sorted_documents(User, cusrom_user_ids)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mongoid_cache_store. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the MongoidCacheStore project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/mongoid_cache_store/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaudhary%2Fmongoid_cache_store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaudhary%2Fmongoid_cache_store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaudhary%2Fmongoid_cache_store/lists"}