File tree 1 file changed +4
-15
lines changed
1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -417,28 +417,17 @@ def self.expire_at(repo_id)
417
417
# Clear the cache entries for given repository
418
418
def self . clear_cache_for_repository ( repository )
419
419
repo_id = repository . git_cache_id
420
-
421
- # Clear cache
422
- old_cached = GitCache . find_all_by_repo_identifier ( repo_id )
423
- if old_cached != nil
424
- old_ids = old_cached . collect ( &:id )
425
- GitCache . destroy ( old_ids )
426
- logger . info { "Removed '#{ old_cached . count } ' expired cache entries for repository '#{ repo_id } '" }
427
- end
420
+ deleted = GitCache . delete_all ( [ "repo_identifier = ?" , repo_id ] )
421
+ logger . info { "Removed '#{ deleted } ' expired cache entries for repository '#{ repo_id } '" }
428
422
end
429
423
430
424
431
425
# After resetting cache timing parameters -- delete entries that no-longer match
432
426
def self . clear_obsolete_cache_entries
433
427
return if max_cache_time < 0 # No expiration needed
434
-
435
428
target_limit = Time . now - max_cache_time
436
- old_cached = GitCache . all ( :conditions => [ "created_at < ?" , target_limit ] )
437
- if old_cached != nil
438
- old_ids = old_cached . collect ( &:id )
439
- GitCache . destroy ( old_ids )
440
- logger . info { "Removed '#{ old_cached . count } ' expired cache entries among all repositories" }
441
- end
429
+ deleted = GitCache . delete_all ( [ "created_at < ?" , target_limit ] )
430
+ logger . info { "Removed '#{ deleted } ' expired cache entries among all repositories" }
442
431
end
443
432
444
433
end
You can’t perform that action at this time.
0 commit comments