Skip to content

twingly/twingly-url_cache

Repository files navigation

Twingly::UrlCache

GitHub Build Status

URL cache, remember if an URL been seen before. Uses Memcached to cache data, prefers MemCachier.

Installation

Add this line to your application's Gemfile:

gem 'twingly-url_cache'

And then execute:

$ bundle

Or install it yourself as:

$ gem install twingly-url_cache

Usage

Initialize an instance, cache an URL with #cache! and look if it's cached with #cached?.

[1] pry(main)> cache = Twingly::UrlCache.new
=> #<Twingly::UrlCache:0x007fd58c96b978 ...>
[2] pry(main)> cache.cache!("http://www.twingly.com/")
=> true
[3] pry(main)> cache.cached?("http://www.twingly.com/")
=> true
[4] pry(main)> cache.cached?("http://blog.twingly.com/")
=> false

Optional environment variables:

MEMCACHIER_SERVERS # Defaults to localhost
MEMCACHIER_PASSWORD
MEMCACHIER_USERNAME

Development

After checking out the repo, run bin/setup to install dependencies. Start memcached. Then, run bundle exec rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Release workflow

  • Update the examples in this README if needed.

  • Bump the version in lib/twingly/url_cache/version.rb in a commit, no need to push (the release task does that).

  • Ensure you are signed in to RubyGems.org as twingly with gem signin.

  • Build and publish the gem. This will create the proper tag in git, push the commit and tag and upload to RubyGems.

      bundle exec rake release
    
  • Update the changelog with GitHub Changelog Generator (gem install github_changelog_generator if you don't have it, set CHANGELOG_GITHUB_TOKEN to a personal access token to avoid rate limiting by GitHub). This command will update CHANGELOG.md. You need to commit and push manually.

      github_changelog_generator -u twingly -p twingly-url_cache
    

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/twingly/twingly-url_cache.

About

❔ URL cache, remember if an URL been seen before

Resources

License

Stars

Watchers

Forks

Packages

No packages published