You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The avatar package has a major problem with caching. It caches the generated avatars forever and does not provide any way to configure or disable the cache. This is bad practice and creates serious issues for developers.
Key Issues:
Cache Forever:
The package caches avatars indefinitely. This means if you change settings like colors, the changes will not take effect because the old cached version is always used.
No Cache Control:
There is no option to:
Set cache duration.
Disable the cache.
Bad Cache Keys:
The cache keys do not have a prefix, which makes it hard to manage or flush specific cache entries. This can cause conflicts with other parts of the application.
The avatar should have a background color of #333333 and a foreground color of #FFFFFF.
What Happened:
The changes to the colors did not work because the result was cached forever, with no way to flush or disable the cache.
Why This Is a Big Problem
Caching Forever Is Bad Practice:
Developers need control over the cache. Caching forever without any configuration option makes the package unreliable.
Cache Key Issues:
Cache keys without a prefix make it hard to clear the cache, especially when using multiple packages with the same caching system.
Suggested Fixes
Add Cache Configuration:
Allow developers to:
Set cache duration (e.g., in seconds, minutes, or hours).
Disable caching completely if needed.
Add Cache Key Prefix:
Use a unique prefix for cache keys (e.g., avatar_) to make them easier to manage.
The text was updated successfully, but these errors were encountered:
I've studied package code and found that cache is used only for base64.
Why do we even need that? It can cause potential issues, so I suggest drop caching as it will remove complexity. If caching needed developer can implement as he wants.
Problem
The
avatar
package has a major problem with caching. It caches the generated avatars forever and does not provide any way to configure or disable the cache. This is bad practice and creates serious issues for developers.Key Issues:
Cache Forever:
The package caches avatars indefinitely. This means if you change settings like colors, the changes will not take effect because the old cached version is always used.
No Cache Control:
There is no option to:
Bad Cache Keys:
The cache keys do not have a prefix, which makes it hard to manage or flush specific cache entries. This can cause conflicts with other parts of the application.
Example Code
I used the following code to generate an avatar:
What I Expected:
The avatar should have a background color of
#333333
and a foreground color of#FFFFFF
.What Happened:
The changes to the colors did not work because the result was cached forever, with no way to flush or disable the cache.
Why This Is a Big Problem
Caching Forever Is Bad Practice:
Developers need control over the cache. Caching forever without any configuration option makes the package unreliable.
Cache Key Issues:
Cache keys without a prefix make it hard to clear the cache, especially when using multiple packages with the same caching system.
Suggested Fixes
Add Cache Configuration:
Add Cache Key Prefix:
avatar_
) to make them easier to manage.The text was updated successfully, but these errors were encountered: