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

3.0/caching issues #8278

Merged

Conversation

Sesquipedalian
Copy link
Member

@Sesquipedalian Sesquipedalian commented Jul 1, 2024

Fixes some issues with caching.

First, there were some problems with the Sqlite cache API that have been fixed in 17f9186.

Second, and more importantly, 17fdb6e changes how we convert cached data to strings. Instead of using json_encode() and json_decode(), we are now using serialize() and unserialize(). This is necessary because in SMF 3.0 we need to cache objects. For example, when caching recent events, we pass a collection of SMF\Calendar\EventOccurrence objects to be cached. Encoding that to JSON loses data and the objects cannot be reconstructed when retrieved, resulting in nasty errors.

@Sesquipedalian Sesquipedalian added this to the 3.0 Alpha 3 milestone Jul 1, 2024
@tyrsson
Copy link
Collaborator

tyrsson commented Jul 1, 2024

Fixes some issues with caching.

First, there were some problems with the Sqlite cache API that have been fixed in 17f9186.

Second, and more importantly, 17fdb6e changes how we convert cached data to strings. Instead of using json_encode() and json_decode(), we are now using serialize() and unserialize(). This is necessary because in SMF 3.0 we need to cache objects. For example, when caching recent events, we pass a collection of SMF\Calendar\EventOccurrence objects to be cached. Encoding that to JSON loses data and the objects cannot be reconstructed when retrieved, resulting in nasty errors.

Sounds familiar.... Sorry, I have not been able to finish the psr compliance work :)

I would follow the usage here:
https://wiki.php.net/rfc/custom_object_serialization#:~:text=The%20__serialize()%20and,if%20it%20represented%20object%20properties.

@Sesquipedalian
Copy link
Member Author

Sounds familiar....

Yup

@Sesquipedalian Sesquipedalian merged commit 6ec916c into SimpleMachines:release-3.0 Jul 2, 2024
6 checks passed
@Sesquipedalian Sesquipedalian deleted the 3.0/caching_issues branch July 2, 2024 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants