Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apcu part is not handling multiple websites well #10

Closed
f1-outsourcing opened this issue Aug 24, 2021 · 4 comments
Closed

apcu part is not handling multiple websites well #10

f1-outsourcing opened this issue Aug 24, 2021 · 4 comments
Labels

Comments

@f1-outsourcing
Copy link

apcu part is not handling multiple websites well. See terrylinooo/cache-master#7

This is how the 'w3 total cache' plugin uses apcu. I guess if you incorporate something like the website name with using the cache, this should be fixed.

w3tc_915778564__34_pgcache_dadcd63b66f42d4e8e6246980ab7fc70_gzip | 8 | 1104 | 2021/08/24 13:40:27 | 2021/08/24 13:38:02 | 2021/08/24 13:38:02 | 86400 seconds | [Delete Now]
w3tc_915778564__33_pgcache_8ff652f57f5ec5b6f56a9e382cb01575_gzip | 4 | 5200 | 2021/08/20 07:51:43 | 2021/08/19 20:17:44 | 2021/08/19 20:17:44 | 86400 seconds | [Delete Now]
w3tc_915778564__1_pgcache_9349156837b1d706e1884c4c6be7f5cc | 4 | 15952 | 2021/08/24 12:45:08 | 2021/08/24 04:01:11 | 2021/08/24 04:01:11 | 86400 seconds | [Delete Now]
w3tc_915778564__33_pgcache_eec34b1b18b401377174ae2548bff425_gzip | 3 | 1104 | 2021/08/20 07:51:33 | 2021/08/19 20:17:46 | 2021/08/19 20:17:46 | 86400 seconds | [Delete Now]
w3tc_915778564__34_pgcache_a2452f70a22449f2d8aceab1723c973c_gzip | 2 | 5200 | 2021/08/24 13:39:42 | 2021/08/24 13:38:10 | 2021/08/24 13:38:10 | 86400 seconds | [Delete Now]
w3tc_915778564__34_pgcache_2ef4ed86b1ce00114efdd0cfdf8301b6_gzip | 2 | 4688 | 2021/08/24 13:54:06 | 2021/08/24 13:37:59 | 2021/08/24 13:37:59 | 86400 seconds | [Delete Now]
w3tc_915778564__33_pgcache_7c73ba90c2b3eeeed89d664d89adbff4_gzip | 2 | 6224 | 2021/08/23 19:45:32 | 2021/08/23 16:56:14 | 2021/08/23 16:56:14 | 86400 seconds | [Delete Now]
w3tc_915778564__33_pgcache_4f8e342babbf61c28004677c44c73824_gzip | 2 | 568 | 2021/08/20 07:21:03 | 2021/08/19 19:15:48 | 2021/08/19 19:15:48 | 86400 seconds | [Delete Now]
@f1-outsourcing
Copy link
Author

f1-outsourcing commented Aug 24, 2021

Yes something like this fixes it, not sure if it is necessary to crc32() the server name.

protected function getAll(): array
{
    $list = [];

    $prefix = 'sc_'.$_SERVER['SERVER_NAME'].'_';

    foreach (new APCUIterator('/^'.$prefix.'/') as $item) {
        $key = str_replace($prefix, '', $item['key']);
        $value = unserialize($item['value']);

        $list[$key] = $value;
    }

    return $list;
}

/**
 * Get the key name of a cache.
 *
 * @param string $key The key of a cache.
 *
 * @return string
 */
private function getKeyName(string $key): string
{
    $prefix = 'sc_'.$_SERVER['SERVER_NAME'].'_';

    return $prefix . $key;
}

@f1-outsourcing
Copy link
Author

Maybe fix this?

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 2 days.

@github-actions github-actions bot added the stale label May 27, 2023
@github-actions
Copy link

github-actions bot commented Jun 3, 2023

This issue was closed because it has been inactive for 14 since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant