1. Now store the cached data that is tagged, and have 2 tags: THEME_EDITOR, THEME_EDITOR_RJXMAECRPPUAD4LLLJLLJLLJDOMXB47HRDVTB2VPW
return Cache::tags([
ThemePreviewInterface::TAG_THEME_EDITOR,
ThemePreviewInterface::TAG_THEME_EDITOR . '_' . $sessionId]
)
->put(ThemePreviewInterface::THEME_EDITOR_SESSION_PREFIX . $sessionId, json_encode($data), ThemePreviewInterface::TTL);
2. After running the program, check the data structure in GUI for Redis. Expand the tag. The value of cache:tag:theme_editor:key is: s:22:”633146b13433b471207802″;. It represents the associated key: cache:633146b13433b471207802:standard_ref. This is the tag: theme_editor generated structure. The total is 2 keys. as shown in Figure 1

3. After running the program, check the data structure in GUI for Redis. Expand the tag. cache:tag:theme_editor_rjxmaecrppuad4ljlljlljdomxb47hrdvtb2vpw:key The value is: S:22:”633146b134d67627586383″;. It represents the associated key: cache:633146b134d67627586383:standard_ref. This is the structure generated by the tag: theme_editor_rjxmaecrppuad4ljlljlljdomxb47hrdvtb2vpw. The total is 2 keys. as shown in Figure 2

4. The value list of the keys associated with the 2 tags is the same, and the corresponding key can be obtained :Cache:327d4fd2bc91588c8a5e4c7248cf680165a2e12a:them E_EDITOR_SESSION:RJXMAECRPPUAD4LLLJLLJDOMXB47HRDVTB2VPW . as shown in Figure 3

5. Decide to delete cache:327d4fd2bc91588c8a5e4c7248cf680165a2e12a:theme _editor_session:rjxmaecrppuad4ljlljlljdomxb47hrdvtb2vpw the corresponding cached data. Do not use the tags method. The result of the operation is False , which means that the deletion failed. as shown in Figure 4

$result = Cache::forget($sessionId);
dd($result);
6. Use the tags method. The result of the operation is true , which means that the deletion was successful. as shown in Figure 5

$result = Cache::tags(ThemePreviewInterface::TAG_THEME_EDITOR . '_' . $sessionId)->flush();
dd($result);
7. Check the data in Redis. Cache:633146b13433b471207802:The associated value list in STANDARD_REF still has 1 records, not deleted: Cache:327d4fd2bc91588c8a5e4c7248cf680165a2e12a:t HEME_EDITOR_SESSION:RJXMAECRPPUAD4LLLJLLJDOMXB47HRDVTB2VPW . Key Cache:633146b134d67627586383:standard_ref has been deleted, and the key corresponding to 1 record in the associated value list in the previous one has also been deleted. in line with expectations. as shown in Figure 6

PHP / Laravel / Yii2 Legacy Project Maintenance & Long-Term Technical Support
If your PHP / Laravel / Yii2 project is already in production but needs bug fixing, API troubleshooting, performance optimization, developer handover support, or long-term maintenance, feel free to contact me for remote technical support.
Ideal For:
✅ PHP legacy systems without active maintenance
✅ Laravel / Yii2 project bug fixes
✅ Admin panel feature iterations
✅ RESTful API troubleshooting
✅ MySQL / Redis / Nginx performance issues
✅ Long-term remote part-time maintenance
We can start with a small task:
✅ Production error troubleshooting
✅ API issue analysis
✅ Slow query and performance bottleneck diagnosis
✅ Initial code structure review
✅ Deployment environment and log inspection
If you would like to discuss your project, please contact me and mention: PHP Maintenance Consultation.
Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

Leave a Reply