hash_file

a hash that persists its data onto disk

hash_file

A hash function that persists its data onto disk. Useful when creating a simple cache

Installation

Add this to your application's shard.yml:

dependencies:
  hash_file:
    github: mehmetc/hash_file

Usage

require "hash_file"

HashFile.config({"base_dir" => "/tmp/cache"})
HashFile["hello"] = "world"
HashFile.store("foo", "bar", {"expire" => (Time.now + 5.minute)}) #5 minutes
puts HashFile["hello"]
HashFile.fetch("foo") unless HashFile.expired?("foo")
HashFile.delete("hello")
HashFile.clear

Contributing

  1. Fork it (https://github.com/your-github-user/hash_file/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • mehmetc Mehmet Celik - creator, maintainer
Repository

hash_file

Owner
Statistic
  • 0
  • 1
  • 0
  • 1
  • 0
  • over 2 years ago
  • July 17, 2018
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 03:45:24 GMT

Languages