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

Recommend caching strategy is no longer valid #7463

Open
andrewjmead opened this issue Aug 30, 2023 · 1 comment
Open

Recommend caching strategy is no longer valid #7463

andrewjmead opened this issue Aug 30, 2023 · 1 comment

Comments

@andrewjmead
Copy link

andrewjmead commented Aug 30, 2023

Hey, folks. Thanks for the great library 🙂

I looks to me that the optional caching strategy recommended in readme.md is no longer valid. It seems that setCache hasn't directly accepted \Doctrine\Common\Cache\CacheProvider since version 3.13.1. For reference, here's the version of setCache in 3.13.1 and here's the next version which is setCache in 4.0.0.

As you can see, it now requires the type to conform to CacheInterface. This is not reflected in the docs.

I was opening this issue to (1) confirm it is an actual issue with the docs and (2) offer to create a PR that addresses it by updating readme.md.

The current recommendation is:

$dd->setCache(new Doctrine\Common\Cache\PhpFileCache('./tmp/'));

I was hoping to update it to:

$dd->setCache(
    new DoctrineBridge(
        new Doctrine\Common\Cache\PhpFileCache('./tmp/')
    )
);

Introducing DoctrineBridge fixed the error I was originally getting.

Here is the current readme.md recommendation for reference:

// OPTIONAL: Set caching method
// By default static cache is used, which works best within one php process (memory array caching)
// To cache across requests use caching in files or memcache
// $dd->setCache(new Doctrine\Common\Cache\PhpFileCache('./tmp/'));

Let me know your thoughts.

@andrewjmead
Copy link
Author

andrewjmead commented Aug 31, 2023

A quick note for anyone else using this. The newest version of doctrine/cache you can use is 1.13.0. The library is deprecated and the 2.x.x releases only contain interfaces for compatibility.

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
@andrewjmead and others