{"id":16904877,"url":"https://github.com/peterzhu2118/rails_throttle","last_synced_at":"2026-05-01T14:32:32.646Z","repository":{"id":56890720,"uuid":"183041213","full_name":"peterzhu2118/rails_throttle","owner":"peterzhu2118","description":"A simple library used to throttle code in your Rails application.","archived":false,"fork":false,"pushed_at":"2022-07-22T03:08:30.000Z","size":23,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-04T17:56:58.846Z","etag":null,"topics":["rails","ruby","security"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/rails_throttle","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/peterzhu2118.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-23T15:12:20.000Z","updated_at":"2019-10-01T17:28:15.000Z","dependencies_parsed_at":"2022-08-20T15:20:57.307Z","dependency_job_id":null,"html_url":"https://github.com/peterzhu2118/rails_throttle","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/peterzhu2118/rails_throttle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterzhu2118%2Frails_throttle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterzhu2118%2Frails_throttle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterzhu2118%2Frails_throttle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterzhu2118%2Frails_throttle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterzhu2118","download_url":"https://codeload.github.com/peterzhu2118/rails_throttle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterzhu2118%2Frails_throttle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["rails","ruby","security"],"created_at":"2024-10-13T18:36:05.351Z","updated_at":"2026-05-01T14:32:32.622Z","avatar_url":"https://github.com/peterzhu2118.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RailsThrottle [![CircleCI](https://circleci.com/gh/peterzhu2118/rails_throttle/tree/master.svg?style=svg)](https://circleci.com/gh/peterzhu2118/rails_throttle/tree/master) [![Gem Version](https://badge.fury.io/rb/rails_throttle.svg)](https://badge.fury.io/rb/rails_throttle)\n\nRailsThrottle is a simple library used to throttle code in your Rails application.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"rails_throttle\", \"~\u003e 0.2.0\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rails_throttle\n\n## Usage\n\n- See full documentation here: https://www.rubydoc.info/gems/rails_throttle/0.4.0/RailsThrottle/Throttle\n- Example configuration (for production, you can configure other environments in a similar way):\n    ```ruby\n    # In config/environments/production.rb\n    RailsThrottle.backend = ActiveSupport::Cache::RedisStore.new \"localhost:6379/0\"\n\n    # Alternatively, also supports any of the other caching strategies of ActiveSupport::Cache.\n    # For details, see https://api.rubyonrails.org/classes/ActiveSupport/Cache.html.\n    ```\n- Example usage:\n    ```ruby\n    RailsThrottle::Throttle.increment(\"foo\", limit: 4, period: 2.seconds) # =\u003e 1\n    RailsThrottle::Throttle.increment(\"foo\", limit: 4, period: 2.seconds) # =\u003e 2\n    RailsThrottle::Throttle.decrement(\"foo\", period: 2.seconds) # =\u003e 1\n    RailsThrottle::Throttle.reset(\"foo\")\n    RailsThrottle::Throttle.increment(\"foo\", limit: 4, period: 2.seconds, increment: 4) # =\u003e 4\n    RailsThrottle::Throttle.increment(\"foo\", limit: 4, period: 2.seconds) # =\u003e RailsThrottle::ThrottleError\n    RailsThrottle::Throttle.throttled?(\"foo\", limit: 5) # =\u003e true\n\n    # ... wait 2 seconds ...\n\n    RailsThrottle::Throttle.throttled?(\"foo\", limit: 5) # =\u003e false\n    ```\n\n## Development\n\nJust the usual clone and `bundle` to install dependencies. Run `rake test` to run tests.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/peterzhu2118/rails_throttle.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterzhu2118%2Frails_throttle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterzhu2118%2Frails_throttle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterzhu2118%2Frails_throttle/lists"}