Skip to content

[FreshRSS] MD5-based caching#401

Closed
Alkarex wants to merge 1 commit intosimplepie:masterfrom
Alkarex:Md5Caching
Closed

[FreshRSS] MD5-based caching#401
Alkarex wants to merge 1 commit intosimplepie:masterfrom
Alkarex:Md5Caching

Conversation

@Alkarex
Copy link
Contributor

@Alkarex Alkarex commented Apr 6, 2015

This patch may not be suited to be merged as-is in SimplePie, but it is used in FreshRSS since February 2014, and may contribute to a discussion/process of improving HTTP caching in SimplePie. It is a part of the process of proposing/reporting upstream the changes made to SimplePie in FreshRSS

Introduces data['mtime'] and data['md5'].

For feeds that do not support HTTP conditional requests, makes a MD5 hash to detect changes.
To do that, some cleaning is needed, e.g. removing comments such as <!-- Generated on XX -->, or <lastBuildDate> which may be changing even when no actual content has changed.
FreshRSS/FreshRSS@9aab83a

SimplePie::init() now returns a positive integer with modification time if using cache, boolean true if otherwise successful, false otherwise.

Take also care of the caching of feeds with errors. Before, the cache system was not used for feeds with errors; there was no protection against repetitive refresh.
FreshRSS/FreshRSS@00127f0

For feeds that do not support HTTP conditional requests, makes a MD5
hash to detect changes.
To do that, some cleaning is needed, e.g. removing comments such as
`<!-- Generated on XX -->`, or `<lastBuildDate>` which may be changing
even when no actual content has changed.

FreshRSS/FreshRSS@9aab83a

Take also care of the caching of feeds with errors. Before the cache
system was not used for feeds with errors; there was no protection
against repetitive refresh.

FreshRSS/FreshRSS@00127f0

Used in production in FreshRSS
Alkarex referenced this pull request in FreshRSS/FreshRSS Apr 6, 2015
Contribue à
#351 (comment)
Pour les flux qui ne supportent pas les requêtes conditionnelles.
Filtre les tags et commentaires gênants avant la signature (style
<lastBuildDate> qui change tout le temps sans que le contenu change,
<slash:comments>, ainsi que les commentaires XML qui détruisent le cache
comme <!-- généré en X secondes -->)

Il reste quelques flux à débogger dont le cache n'est pas encore
optimal. C'est pour cela qu'il reste quelques syslog(LOG_DEBUG, ...).

Au passage, évite que SimplePie fasse une double requête pour vérifier
le cache si le serveur est un peu lent.

Un jour, il faudra nettoyer les changements faits à SimplePie et leur
remonter les patchs les plus intéressants.
Alkarex referenced this pull request in FreshRSS/FreshRSS Apr 6, 2015
Before the cache system was not used for feeds with errors, which was
problematic especially if several users have this feed.
Furthermore, there was no protection against repetitive refresh.

Bonus: slightly better performance by avoiding some superfluous
file_exists().

Warning: needs a bit of testing
#681
Alkarex added a commit to Alkarex/simplepie that referenced this pull request Jul 11, 2015
@mblaney
Copy link
Member

mblaney commented Mar 15, 2016

Hi @Alkarex, I don't like the idea of changing the init() signature, you could expose mtime with a member variable if you want access to it.

@skyzyx skyzyx closed this Jun 26, 2017
@Alkarex Alkarex deleted the Md5Caching branch April 25, 2022 08:47
Alkarex added a commit to FreshRSS/simplepie that referenced this pull request Jun 23, 2024
This was referenced Jun 23, 2024
Alkarex added a commit to FreshRSS/simplepie that referenced this pull request Aug 17, 2024
Alkarex added a commit to FreshRSS/simplepie that referenced this pull request Sep 8, 2024
* Hash-based caching
simplepie#401
FreshRSS/FreshRSS@9aab83a
FreshRSS/FreshRSS@00127f0

* Backport fix
FreshRSS/FreshRSS#6723

* A few fixes

* Reduce changes

* Reduce changes

* Relax some tests

* Fix comment

* Fix a few tests

* PHP 7.2 compatibility

* Behaviour fixes

* Simplification

* Comment

* Fix tests

* Remove debug logs

* Minor comment

* Fix type mess with $this->data['headers']
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

Successfully merging this pull request may close these issues.

3 participants