Skip to content

Linting the very same file in different file-system locations should re-use a single cache file #224

@staabm

Description

@staabm

in our concrete case the file-cache is taking a lot of space, because our file-structure in the filesystem has a incrementing counter:

complexit@ci24:/www/www/apps/motiontm$ tree -L 2
.
├── current -> releases/38
├── releases
│   ├── 3118
│   ├── 3119
│   ├── 3120
│   ├── 3121
│   ├── 3122
│   ├── 3228
│   ├── 3229
│   ├── 3230
│   ├── 3231
│   ├── 3232
│   ├── 34
│   ├── 35
│   ├── 36
│   ├── 37
│   └── 38
└── shared

19 directories, 0 files

this means the folders under the numbered folders contain mostly the same files.
its a rolling release, meaning the webserver is using a symlink "current" and we build the app in parallel to production and only switch the symlink after the deployment finished (its a common pattern).

this means e.g. the following paths

app/releases/3118/test.php
app/releases/3119/test.php
app/releases/3120/test.php

are very likely the very same files.

if I read the cache files correctly, I think this means the current file-cache will have a single cache file for every file in our scenario (as the cache file contains the absolute file-system path).
wouldn't it be possible instead to use a content hash of the file, so we can re-use a single cache file for all identical copies of a single .php file?
this would save a lot of file space in the cache directory and it would also lead to a higher cache hit rate, which makes it more efficient

tested on phplint 9.5.6 and PHP 8.3

extracted from a different thread: #218 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions