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

Cache miss even though an entry should be found #12

Closed
swentel opened this issue Oct 12, 2020 · 1 comment
Closed

Cache miss even though an entry should be found #12

swentel opened this issue Oct 12, 2020 · 1 comment

Comments

@swentel
Copy link
Contributor

swentel commented Oct 12, 2020

It looks like, even though cache is written to the file system, the cache is missed on the next request.

Some sample code; Note: the functions return ttl and the actual path which are configurable in the drupal module, but it also happens with the default cache settings.

    $config += [
      'cache' => [
        'ttl' => activitypub_cache_ttl(),
        'stream' => activitypub_cache_path()
      ],
    ];
    $config['instance']['types'] = 'ignore';
    return new Server($config);

  ...

  $server->actor($target)->get('inbox')

I did some naive debugging in Request.php to find out it didn't get into the ::has statement

        print_r("CHECKING $url");
        if (CacheHelper::has($url)) {
            print_r("FOUND");
            return CacheHelper::get($url);
        }
        try {
            print_r("DAMN");
            $content = $this->client->get($url)->getBody()->getContents();
        } catch (\GuzzleHttp\Exception\ClientException $exception) {
            throw new Exception($exception->getMessage());
        }

        CacheHelper::set($url, $content);

        return $content;
@swentel swentel changed the title Cache miss even though it an entry should be found Cache miss even though an entry should be found Oct 12, 2020
@landrok
Copy link
Owner

landrok commented Oct 22, 2020

Fixed and released 0.5.1 👍

@landrok landrok closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants