diff options
Diffstat (limited to 'operators/timer_uncache.zsh')
| -rw-r--r-- | operators/timer_uncache.zsh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/operators/timer_uncache.zsh b/operators/timer_uncache.zsh new file mode 100644 index 0000000..4af2543 --- /dev/null +++ b/operators/timer_uncache.zsh @@ -0,0 +1,26 @@ +# Copyright (C) 2024-2026 Maria Lisina +# Copyright (C) 2024-2026 Danil Lisin +# SPDX-License-Identifier: Apache-2.0 + +if [[ -n "${no_clear}" ]] +then + return +fi + +for file in $(find "${cache}" -follow -type f) +do + if ! mkdir "${file%.*}.lock" + then + continue + fi + + file_ctime=$(strftime %s) + file_mtime=$(stat +mtime "${file}") + + if [[ $((file_ctime - file_mtime)) -gt ${cache_time} ]] + then + rm -f "${file}" + fi + + rmdir "${file%.*}.lock" +done |
