Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
evokelektrique committed Nov 2, 2021
1 parent 51a4bfc commit 98117f0
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Kubo

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/kubo`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
Kubo is a Ruby gem to file cache easily.

## Installation

Expand All @@ -21,15 +18,38 @@ Or install it yourself as:
$ gem install kubo

## Usage
```ruby
# Initializing a Zip instance to compress data to GZip and the Zip class
# takes two arguments for expiration and a path for storing keys.
# Kubo::Zip.new(time, path)
# `time` argument could be "1s", "1h", "1d" which it will be converted to seconds later.
kubo = Kubo::Zip.new("1h", "./cache/my_cache_folder")

# Save a key with value
key = "my_key"
value = "My value"
kubo.save(key, value)

TODO: Write usage instructions here
# Read a key
kubo.read(key) # => "My value"

# Check expiration of a key
kubo.expired?(key)

# Flush / Truncate a key
kubo.flush(key)

# Delete a key
kubo.delete(key)
kubo.delete_if_expired(key) # Deletes the key if it's expired.
```

## Development

After 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.

To 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
To install this gem onto your local machine, run `bundle exec rake install`.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/kubo.
Bug reports and pull requests are welcome on GitHub at https://github.com/evokelektrique/kubo.

0 comments on commit 98117f0

Please sign in to comment.