yegor256 / zache

Zero-footprint Ruby In-Memory Thread-Safe Cache: when a naive implementation is enough
https://www.yegor256.com/2019/02/05/zache.html
MIT License
42 stars 6 forks source link

Zache#clean is broken? #75

Closed jviney closed 2 months ago

jviney commented 6 months ago

https://github.com/yegor256/zache/blob/master/lib/zache.rb#L180 passes the value to #expired?, but it's expecting the key.

yegor256 commented 3 months ago

@jviney most probably a bug. Can you please submit a pull request together with a unit test reproducing the issue? I will greatly appreciate it!

miclast commented 2 months ago

class Zache def clean synchronized { @hash.delete_if { |key, _value| expired?(key) } } # key should be used instead value here end end

Fix for this bug.

yegor256 commented 2 months ago

@rultor release, tag 0.13.2

rultor commented 2 months ago

@rultor release, tag 0.13.2

@yegor256 OK, I will release it now. Please check the progress here

rultor commented 2 months ago

@rultor release, tag 0.13.2

@jviney @yegor256 Oops, I failed. You can see the full log here (spent 2min)

+ set -e
+ set -o pipefail
++ dirname ./run.sh
+ cd .
+ echo 1246
+ echo '2.0-SNAPSHOT BUILD'
2.0-SNAPSHOT BUILD
+ date
Thu Jul 18 12:04:30 UTC 2024
+ uptime
 12:04:30 up 1 min,  0 users,  load average: 1.19, 0.41, 0.15
+ head=git@github.com:yegor256/zache.git
+ ff=default
+ image=yegor256/rultor-image:1.23.1
+ rebase=false
+ squash=false
+ head_branch=master
+ author=yegor256
+ vars=('--env=head=git@github.com:yegor256/zache.git' '--env=scripts=( '\''export '\''\'\'''\''head=git@github.com:yegor256/zache.git'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''head_branch=master'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''author=yegor256'\''\'\'''\'''\'' '\'';'\'' '\''pdd -f /dev/null'\'' '\'';'\'' '\''sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"'\'' '\'';'\'' '\''bundle exec rake'\'' '\'';'\'' '\''pdd -f /dev/null'\'' '\'';'\'' '\''rm -rf *.gem'\'' '\'';'\'' '\''sed -i "s/0\.0\.0/${tag}/g" zache.gemspec'\'' '\'';'\'' '\''git add zache.gemspec'\'' '\'';'\'' '\''git commit -m "Version set to ${tag}"'\'' '\'';'\'' '\''gem build zache.gemspec'\'' '\'';'\'' '\''chmod 0600 ../rubygems.yml'\'' '\'';'\'' '\''gem push *.gem --config-file ../rubygems.yml'\'' '\'';'\'' )' '--env=head_branch=master' '--env=author=yegor256')
+ scripts=('export '\''head=git@github.com:yegor256/zache.git'\''' ';' 'export '\''head_branch=master'\''' ';' 'export '\''author=yegor256'\''' ';' 'pdd -f /dev/null' ';' 'sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"' ';' 'bundle exec rake' ';' 'pdd -f /dev/null' ';' 'rm -rf *.gem' ';' 'sed -i "s/0\.0\.0/${tag}/g" zache.gemspec' ';' 'git add zache.gemspec' ';' 'git commit -m "Version set to ${tag}"' ';' 'gem build zache.gemspec' ';' 'chmod 0600 ../rubygems.yml' ';' 'gem push *.gem --config-file ../rubygems.yml' ';')
+ directory=
+ container=yegor256_zache_75
+ as_root=false
+ hostname
ip-172-31-20-37
+ pwd
/tmp/rultor-9F4L
+ git --version
git version 2.34.1
+ docker --version
Docker version 25.0.3, build 4debf41
+ mkdir -p /home/ubuntu/.ssh
+ echo -e 'Host github.com\n\tStrictHostKeyChecking no\n'
+ chmod 600 /home/ubuntu/.ssh/config
+ git clone git@github.com:yegor256/zache.git repo
Cloning into 'repo'...
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
+ cd repo
+ git config user.email me@rultor.com
+ git config user.name rultor
+ '[' -z 'export '\''head=git@github.com:yegor256/zache.git'\''' ']'
+ cd ..
+ cat
+ '[' false = true ']'
+ cat
+ chmod a+x entry.sh
+ cat
+ echo 'export '\''head=git@github.com:yegor256/zache.git'\''' ';' 'export '\''head_branch=master'\''' ';' 'export '\''author=yegor256'\''' ';' 'pdd -f /dev/null' ';' 'sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"' ';' 'bundle exec rake' ';' 'pdd -f /dev/null' ';' 'rm -rf *.gem' ';' 'sed -i "s/0\.0\.0/${tag}/g" zache.gemspec' ';' 'git add zache.gemspec' ';' 'git commit -m "Version set to ${tag}"' ';' 'gem build zache.gemspec' ';' 'chmod 0600 ../rubygems.yml' ';' 'gem push *.gem --config-file ../rubygems.yml' ';'
+ sensitive=()
+ rm -rf .gnupg
+ '[' -z '' ']'
+ echo 'tag name is not provided in the request, see http://doc.rultor.com/basics.html'
tag name is not provided in the request, see http://doc.rultor.com/basics.html
+ exit -1
'cid' file is absent, most probably the Docker container wasn't started correctly
yegor256 commented 2 months ago

@rultor release, tag is 0.13.2

rultor commented 2 months ago

@rultor release, tag is 0.13.2

@yegor256 OK, I will release it now. Please check the progress here

rultor commented 2 months ago

@rultor release, tag is 0.13.2

@yegor256 Done! FYI, the full log is here (took me 8min)

yegor256 commented 2 months ago

@jviney should be resolved, try version 0.13.2