PHPSocialNetwork / phpfastcache

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
https://www.phpfastcache.com
MIT License
2.36k stars 452 forks source link

chore: support psr/cache:2 compatibility layer #833

Closed bshaffer closed 2 years ago

bshaffer commented 2 years ago

Proposed changes

Adds support the psr/cache:2 compatibility layer. This will allow projects which are still on psr/cache:1 to be installed alongside this library on PHP 8.

Any library which supports psr/cache:1 can support psr/cache:2, and any library that can support psr/cache:3 can also support psr/cache:2, without breaking anyone or making any changes. This allows everyone to coexist until they can add support for psr/cache:3

See https://github.com/googleapis/google-auth-library-php/issues/363 for an example of the issue which takes place now, and why we cannot easily fix it.

Types of changes

What types of changes does your code introduce to Phpfastcache? Put an x in the boxes that apply

Agreement

I have read the CONTRIBUTING and CODING GUIDELINE docs

Geolim4 commented 2 years ago

Hello @bshaffer,

I already tried to support both version but its not working neither, I think that there is one more blocking dependency: google/grpc-gcp which require psr/cache ^1.0.1

E:\wamp\www\phpfastcache>composer require google/cloud-firestore
Using version ^1.20 for google/cloud-firestore
./composer.json has been updated
Running composer update google/cloud-firestore
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - google/grpc-gcp[0.1.0, ..., 0.1.5] require psr/cache ^1.0.1 -> found psr/cache[1.
0.1] but it conflicts with your root composer.json require (2.0).
    - google/cloud-firestore v1.20.0 requires google/gax ^1.1 -> satisfiable by google/
gax[1.1.0, ..., v1.9.0].
    - google/gax[1.1.0, ..., v1.9.0] require google/grpc-gcp ^0.1.0 -> satisfiable by g
oogle/grpc-gcp[0.1.0, ..., 0.1.5].
    - Root composer.json requires google/cloud-firestore ^1.20 -> satisfiable by google
/cloud-firestore[v1.20.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals
for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original co
ntent.
bshaffer commented 2 years ago

@Geolim4 thank you for your comment, but that does not have anything to do with this PR, but rather with the google/cloud-firestore library.

Geolim4 commented 2 years ago

@Geolim4 thank you for your comment, but that does not have anything to do with this PR, but rather with the google/cloud-firestore library.

Yes and no, this PR will still be blocked until the google/cloud-firestore is also patched to supported at least 2.0.

bshaffer commented 2 years ago

@Geolim4 no it won't be. This library does not rely on google/cloud-firestore, so there's no way this PR would be blocked by something that takes place in google/cloud-firestore. What you mean is your issue which you logged in a separate repository would be blocked.

Geolim4 commented 2 years ago

The library will rely on google/cloud-firestore before the release of the V9 to support Google Firestore backend. However this will not be a composer "requirement" but a composer "suggestion".

Like I'm actually doing for every other backend (Mongodb, Couchbase, Couchdb, etc).

However, the tests on the CI will install the full deps suggestion list to test EVERY supported backend (See Travis.yml).

So actually I'm blocked by google/cloud-firestore because two of its dependency are incompatible with psr/cache 3.0:

Geolim4 commented 2 years ago

Thanks for the PR @bshaffer I have to also update the .lock in another commit but its fine.