Skip to content

Conversation

@afragen
Copy link
Contributor

@afragen afragen commented Sep 9, 2025

Use transients not wp_cache_* for fair-plugin

Signed-off-by: Andy Fragen <andy@thefragens.com>
Copy link
Member

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Just left a question about prefixing the transient since the cache group isn't there anymore.


More generally, it'd be nice to standardize the constants for cache prefixes for these at some point with consistent naming and where they're defined with something like:

// inc/namespace.php
const CACHE_BASE = 'fair-';
const CACHE_LIFETIME = 12 * HOUR_IN_SECONDS;

// inc/packages/namespace.php
use const FAIR\CACHE_BASE;

const CACHE_METADATA_ENDPOINTS = CACHE_BASE . 'metadata-endpoints-';
const CACHE_METADATA_DOCUMENTS = CACHE_BASE . 'metadata-documents-';
const CACHE_RELEASE_PACKAGES = CACHE_BASE . 'release-packages-';

return $document;
}
wp_cache_set( $id, $document, 'did-docs', CACHE_LIFETIME );
set_transient( $id, $document, CACHE_LIFETIME );
Copy link
Member

Choose a reason for hiding this comment

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

Should the transient names be prefixed since we don't have the cache group anymore?

@afragen
Copy link
Contributor Author

afragen commented Sep 9, 2025

Seems like something for another PR unless you want me to update here?

Signed-off-by: Andy Fragen <andy@thefragens.com>
@costdev costdev merged commit 484307b into fairpm:main Sep 9, 2025
46 checks passed
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.

2 participants