![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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/async_storage
. To experiment with that code, run bin/console
for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Add this line to your application's Gemfile:
gem 'async_storage'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install async_storage
** Idea about the API of this gem. Update accordingly before release it
Define global configurations
# Configurations
AsyncStorage.configuration do |config|
config.redis = ConnectionPool.new(size: 10, timeout: 1) do
Redis.new(url: ENV.fetch('REDIS_URL', 'redis://0.0.0.0:6379'))
end
config.namespace = 'async_storage' # Default to 'async_storage'
config.expires_in = 3_600 # Default to nil
config.circuit_breaker = true # Call the resolver instead of thrown redis connection error when the redis service is down. Default to true
end
Useful methods to get, set and check data
# app/resolvers/user_tweets_resolver.rb
class UserTweetsResolver
def call(user_id)
# Return JSON friendly object
{ 'user_id' => user_id, 'tweets' => Twitter::API.tweets(user_id).as_json }
end
end
AsyncStorage[UserTweetResolver].get('123') # Try to retrieve data. If does not exist enqueue a Background Job and return nil
AsyncStorage[UserTweetResolver].get!('123') # Try to retrieve data. If does not exist imediate call the Resolver and return data
AsyncStorage[UserTweetResolver, namespace: current_site.id].get(9) # Create a new Set using site id namepace
AsyncStorage[UserTweetResolver, expires_in: 60].get(9) # Overwrite global expires_in
class Site
# site.cache.user_tweets.get(@user.id)
def cache
Cache.new(self.slug)
end
class Cache
RESOLVERS = {
user_tweets: UserTweetsResolver,
}.freeze
RESOLVERS.each do |method, resolver|
define_method method do
AsyncStorage[resolver, namespace: @namespace]
end
end
def initialize(namespace)
@namespace = namespace
end
end
end
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 tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/marcosgz/async_storage.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that async_storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.