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

Use Psr16 cache as Default, deprecate \SimplePie\Cache\Base implementations #752

Merged
merged 56 commits into from
Oct 30, 2022

Conversation

Art4
Copy link
Contributor

@Art4 Art4 commented Oct 14, 2022

Hi all 👋

This is a follow-up PR of #742. I propose this PR for SimplePie 1.8, see #731.

In this PR I've changed the internal cache usage to a more PSR-16 style, see the new interface SimplePie\Cache\DataCache. This interface could be removed in SimplePie 2.0 and the provided PSR-16 implementation can be used directly. This will bring us more advantages like \Psr\SimpleCache\CacheInterface::setMultiple().

For BC reasons I've created a simple adapter class SimplePie\Cache\BaseDataCache for the current SimplePie\Cache\Base implementations. This allows us to use the PSR-16 implementation from #742, but also support the old cache implementations. Furthermore I deprecated all cache implementations in favor of the PSR-16 cache.

This will

@Art4 Art4 marked this pull request as draft October 14, 2022 10:49
@Art4 Art4 mentioned this pull request Oct 14, 2022
48 tasks
src/Cache/DataCache.php Outdated Show resolved Hide resolved
@Art4 Art4 marked this pull request as ready for review October 24, 2022 13:31
@jtojnar
Copy link
Contributor

jtojnar commented Oct 26, 2022

Might be nice to rebase this onto master so it can be reviewed commit by commit more easily.

@Art4
Copy link
Contributor Author

Art4 commented Oct 27, 2022

Sorry, I tried to rebase but I failed. I don't have much experience with rebase (maybe because I prefer merge) and the conflicts were to complicated for me.

You can start reviewing by commit 07ff3cb. Older commits are already merged with #742.

@mblaney mblaney merged commit bb38d74 into simplepie:master Oct 30, 2022
@Art4 Art4 deleted the use-psr16-cache-internally branch October 30, 2022 05:24
@Art4 Art4 mentioned this pull request Oct 30, 2022

- The method `SimplePie\SimplePie::set_cache_location()` is deprecated, use `SimplePie\SimplePie::set_cache()` instead
- The method `SimplePie\SimplePie::force_cache_fallback()` is deprecated, expired cache will not be used anymore
- The class `SimplePie\Cache` is deprecated, use implementation of `SimplePie\SimplePie::set_cache()` instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this say Psr\SimpleCache\CacheInterface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought while using SimplePie\Cache will not only allow you to get a cache implementation but also to register a cache implementation the reference to SimplePie\SimplePie::set_cache() makes that clearer.

@@ -0,0 +1,157 @@
<?php
/**
* SimplePie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of topic but I wonder if it might make sense to replace blurbs with SPDX identifiers, see

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never heard of reuse.software before, but it sounds good.

return $default;
}

// ingore data if internal cache expiration time is not set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #761

use InvalidArgumentException;

/**
* Simplified PSR-16 Cache client for caching data arrays
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplifies how?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses only a subset of PSR-16 (only get(), set() and delete(), but not has(), getMultiple(), setMultiple() or deleteMultiple()),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to mention it explicitly in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #761

Art4 added a commit to Art4/simplepie that referenced this pull request Nov 4, 2022
see comment from @jtojnar in simplepie#752
Art4 added a commit to Art4/simplepie that referenced this pull request Nov 4, 2022
mblaney pushed a commit that referenced this pull request Jan 20, 2023
* bump version to 1.8.0

* Update CHANGELOG.md

* Fix version tags in deprecated messages

* fix version in old deprecation messages

* Fix typo

see comment from @jtojnar in #752

* Add comment for DataCache interface

see comment from @jtojnar in #752

* Update CHANGELOG.md for #760, #764 and #765

* Update CHANGELOG.md for #762, #767 and #763

* Update CHANGELOG.md for #768 and #770

* Update release date

* Update CHANGELOG.md for #769 and #771

* Update CHANGELOG.md for #766
@jtojnar jtojnar mentioned this pull request Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants