Skip to content

Commit

Permalink
add warning regarding metaprogramming
Browse files Browse the repository at this point in the history
  • Loading branch information
akerl committed Nov 25, 2013
1 parent 25a60f2 commit bee2373
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
basiccache (0.0.23)
basiccache (0.0.24)

GEM
remote: https://rubygems.org/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -134,6 +134,10 @@ Does the cache include 'test'? true
Does the cache include 'test' now? false
```

## Important Note About Keys

BasicCache attempts to guess the key name from the stack by looking for the name of the method that called it. This is convenient for most use cases, but if you're using metaprogramming or nested code blocks, this can cause that method name to be "block (2 levels) in \<top (required)>" or similar. In this case, keys can conflict and give back weird results. The fix is for you to manually specify your own keys to .cache calls.

## Installation

gem install basiccache
Expand Down
2 changes: 1 addition & 1 deletion basiccache.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'basiccache'
s.version = '0.0.23'
s.version = '0.0.24'
s.date = Time.now.strftime("%Y-%m-%d")
s.summary = 'Provides a minimal key/value caching layer'
s.description = "Allows an application to dynamically cache values and retrieve them later"
Expand Down

0 comments on commit bee2373

Please sign in to comment.