Skip to content

Commit 8e39728

Browse files
Copilotnhorton
andcommitted
Fix delete_entry to correctly track deletion status
Co-authored-by: nhorton <[email protected]>
1 parent 8e78912 commit 8e39728

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/active_support/cache/source_control_cache_store.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ def write_entry(key, entry, **options)
9090
#
9191
# @param key [String] The cache key
9292
# @param options [Hash] Options (unused)
93-
# @return [Boolean] Returns true if the entry was deleted
93+
# @return [Boolean] Returns true if any file was deleted
9494
def delete_entry(key, **options)
9595
hash = hash_key(key)
9696
key_file = key_path(hash)
9797
value_file = value_path(hash)
9898

9999
deleted = false
100-
deleted = File.delete(key_file) if File.exist?(key_file)
101-
deleted = File.delete(value_file) if File.exist?(value_file)
100+
deleted = true if File.exist?(key_file) && File.delete(key_file)
101+
deleted = true if File.exist?(value_file) && File.delete(value_file)
102102

103103
deleted
104104
end

0 commit comments

Comments
 (0)