Cache Not Storing Translations
Symptoms
- Every page load triggers new API call
- High API costs despite cache enabled
- Translation takes same time on repeat visits
- Cache statistics show 0% hit rate
- Clear all cache
- Visit a page in Spanish
- Check database: should see new rows in wpstptranslations
- Revisit same page: should load faster
- User needs INSERT, UPDATE, SELECT privileges
- Contact hosting provider to verify
- Or manually grant:
- Check hosting disk quota
- Clean up old backups and files
- Upgrade hosting plan if needed
- Some caching plugins interfere with database writes
- Try temporarily disabling caching plugin
- If fixed, configure caching plugin to exclude:
- If using Redis/Memcached, verify it’s working:
- Reinstall object cache plugin if false
- Updated content still shows old translation
- Content edited but translation unchanged
- New content shows old translations
- Cache not invalidating on content update
- Very long cache duration
- External caching layers not clearing
- Cloudflare: Purge Everything or Purge by URL
- Other CDNs: Check their documentation
- Set up webhook for automatic CDN purge on content update
- Database size increasing rapidly
- Slow database queries
- “Disk quota exceeded” errors
- Site slowdown over time
- Cache hit rate = % of pages served from cache
- Should be 90%+ for good performance
- Low rate = frequent API calls, higher costs
- Install Redis Object Cache Plugin:
- Check Redis Configuration:
- Restart Redis:
- Check Redis Memory:
- Install “Memcached Object Cache” plugin
- Copy object-cache.php to wp-content/
- Verify in Settings → Memcached
- Memcached not installed on server (contact host)
- Wrong server address in configuration
- Firewall blocking connection
- Insufficient memory allocation
- Spanish speakers see English
- Language switches but content doesn’t
- Random language appearing
- Go to Caching → Configuration
- Cache Key: Custom
- Add Query String: lang
- Add Cookie: stp_language
- Purge Everything
- URL with language (example.com/es/)
- Language cookie if using cookies
- Accept-Language header if auto-detecting
- HIT = served from cache (good)
- MISS = not cached
- BYPASS = caching disabled for this request
- Enable Caching for HTML:
- Remove Cache-Busting Headers:
- Set Correct Cache Rules:
- Pages with language parameter
- Static assets (CSS, JS, images)
- Flag images
- Admin pages
- Login pages
- Checkout/cart pages (if e-commerce)
- PHP memory: Should be 256MB+
- MySQL connections: Sufficient for traffic
- CPU: Not constantly at 100%
- Cache hit rate (weekly)
- Database size (monthly)
- API costs (daily if automatic translation)
- Page load times (weekly)
- Clear cache older than 90 days
- Optimize database tables
- Review error logs
- Check disk space
- Review translation quality
- Update outdated translations
- Clean orphaned data
- Cache functionality
- Performance with cache
- Cache clearing
- Multi-language caching
- Gather Information:
- Run Diagnostic:
- Contact Support:
- Performance Optimization
- Common Issues
- Translation Cache System
Diagnosis Steps
1. Verify Cache is Enabled:
`
ShahiTranslate Pro → Settings → General → Cache Settings
Ensure “Enable Translation Cache” is checked
`
2. Check Database Tables:
`sql
— Run in phpMyAdmin
SHOW TABLES LIKE ‘wpstptranslations’;
SELECT COUNT(*) FROM wpstptranslations;
`
Should show the table exists and has rows
3. Check Error Logs:
`
Tools → Site Health → Info → Server → Error Log
Look for database permission errors
`
4. Test Cache Write:
`
`
Solutions
Database Permission Issues:
`sql
GRANT INSERT, UPDATE, SELECT ON databasename.wpstp_translations TO ‘user’@’localhost’;
`
Table Corruption:
`sql
— Run in phpMyAdmin
REPAIR TABLE wpstptranslations;
OPTIMIZE TABLE wpstptranslations;
`
Insufficient Disk Space:
Cache Plugin Conflict:
– Table: wpstptranslations
– Database writes from caching
Object Cache Misconfiguration:
`php
// Add to test file
vardump(wpusingextobject_cache());
// Should return true if object cache active
`
Cache Serving Stale Content
Symptoms
Causes
Solutions
Immediate Fix – Manual Clear:
`
ShahiTranslate Pro → Settings → General → Clear Cache
Select “Clear Specific Content” → Choose the affected page
`
Enable Auto-Invalidation:
`
Settings → Advanced → Cache → Auto-Invalidation
✅ Clear cache when content updated
✅ Clear cache when translation edited
✅ Clear cache on settings change
`
Reduce Cache Duration (if updates frequent):
`
Settings → General → Cache Duration
Change from 90 days to 7 days for frequently updated content
`
Configure Caching Plugin:
For WP Rocket:
`
WP Rocket → Advanced → Never cache these cookies:
Add: stplanguage, stpcache_bypass
`
For W3 Total Cache:
`
Performance → Page Cache → Never cache these pages:
Add: .lang=[^&]
`
Clear CDN Cache:
Verify Cache Keys:
`
Settings → Advanced → Cache → Cache Key Components
✅ URL
✅ Language
✅ Post ID
✅ Last Modified Time (This is key!)
`
Cache Growing Too Large
Symptoms
Check Current Size
Via phpMyAdmin:
`sql
SELECT
ROUND(SUM(datalength + indexlength) / 1024 / 1024, 2) AS “Size (MB)”
FROM information_schema.TABLES
WHERE tableschema = “yourdatabase_name”
AND tablename = “wpstp_translations”;
`
Via Plugin Dashboard:
`
ShahiTranslate Pro → Dashboard → Cache Statistics
Look at “Cache Size”
`
Solutions
Enable Auto-Cleanup:
`
Settings → Advanced → Cache → Cleanup Settings
✅ Enable automatic cleanup
Interval: Weekly
Keep translations from: Last 30 days
Max cache size: 500 MB
`
Manual Cleanup:
`
Settings → General → Clear Cache
Choose: “Clear cache older than X days”
Enter: 90 days
`
Remove Orphaned Translations:
`
ShahiTranslate Pro → Tools → Database Cleanup
✅ Remove translations for deleted content
✅ Remove duplicate entries
Click “Clean Database”
`
Optimize Tables:
`sql
— Run in phpMyAdmin monthly
OPTIMIZE TABLE wpstptranslations;
OPTIMIZE TABLE wpstpmanual_translations;
`
Reduce Cached Languages:
`
Settings → Languages
Deactivate languages you don’t actually need
Each language multiplies cache size
`
Enable Compression:
`
Settings → Advanced → Cache → Compression
✅ Enable cache compression (reduces size by 40-60%)
`
Set Maximum Size:
`
Settings → Advanced → Cache
Max cache size: 1 GB (or appropriate limit)
When reached, oldest entries automatically deleted
`
Low Cache Hit Rate
What It Means
Check Hit Rate
`
ShahiTranslate Pro → Dashboard → Cache Statistics
Cache Hit Rate: Should show 90%+
`
Causes and Solutions
Cause: Cache Not Warmed
Solution – Warm the Cache:
`
ShahiTranslate Pro → Tools → Cache Warming
Select: All published posts and pages
Languages: All active languages
Click: “Start Cache Warming”
`
Cause: Cache Duration Too Short
Solution:
`
Settings → General → Cache Duration
Increase from 7 days to 30 days
For static content: 90 days
`
Cause: Content Changing Frequently
Solution:
`
This is expected for dynamic content
Cache what you can:
✅ Static pages
✅ Old blog posts
⬜ Live feeds
⬜ Real-time data
`
Cause: Low Traffic
Solution:
`
Low traffic = fewer cache opportunities
Schedule cache warming for all content
Or wait as traffic increases
`
Cause: Many Languages, Small Audience per Language
Solution:
`
Focus on main languages
Deactivate rarely used languages
Use on-demand translation for others
`
Cause: Cache Being Cleared Too Frequently
Solution:
`
Settings → Advanced → Cache → Auto-Invalidation
Review what triggers cache clear
Disable aggressive clearing rules
`
Object Cache Issues
Redis Not Working
Check if Redis is Running:
`bash
SSH to server
redis-cli ping
Should respond: PONG
`
Check WordPress Connection:
`php
// Add temporary test page
dump(wpusingextobject_cache());
// Should be true
vardump(wpcacheget(‘testkey’));
wpcacheset(‘testkey’, ‘testvalue’, ”, 3600);
vardump(wpcacheget(‘testkey’));
// Should show ‘test_value’
?>
`
Solutions:
`
Plugins → Add New → Search “Redis Object Cache”
Install and activate
Settings → Redis → Enable Object Cache
`
`php
// In wp-config.php
define(‘WPREDISHOST’, ‘127.0.0.1’);
define(‘WPREDISPORT’, 6379);
define(‘WPREDISPASSWORD’, ‘your-password’); // if set
define(‘WPREDISDATABASE’, 0);
`
`bash
sudo service redis-server restart
`
`bash
redis-cli info memory
Check used_memory vs maxmemory
`
Memcached Not Working
Check if Running:
`bash
echo “stats” | nc 127.0.0.1 11211
`
Install Memcached Plugin:
`
`
Common Issues:
CDN Caching Issues
CDN Serving Wrong Language
Symptoms:
Cause: CDN not aware of language variations
Solutions:
Cloudflare:
`
`
KeyCDN:
`
Zone → Advanced Settings
Cache Key: Enable
Include Query Parameters: yes
Add: lang parameter
`
Generic CDN:
`
Ensure cache key includes:
`
CDN Not Caching at All
Check CDN Cache Status:
`
Browser DevTools → Network tab
Look for X-Cache header:
`
Solutions:
`
Most CDNs don’t cache HTML by default
Enable in CDN settings
Set appropriate cache duration (1 hour – 1 day)
`
`php
// Add to theme functions.php
addfilter(‘wpheaders’, function($headers) {
if (is_singular()) {
unset($headers[‘Cache-Control’]);
$headers[‘Cache-Control’] = ‘public, max-age=3600’;
}
return $headers;
});
`
`
CDN should cache:
CDN should NOT cache:
`
Performance Still Slow
After Enabling Cache
Run Speed Test:
`
Tools: GTmetrix, Pingdom, Google PageSpeed Insights
Test both default and translated versions
`
Common Issues:
1. Database Queries Not Optimized:
`sql
— Add indexes if missing
ALTER TABLE wpstptranslations
ADD INDEX idxlookup (postid, language, cache_key);
ALTER TABLE wpstptranslations
ADD INDEX idxexpires (expiresat);
`
2. Too Many Translations per Page:
`
Settings → Advanced → Content Settings
Disable translation for:
⬜ Comments
⬜ Widgets (translate manually in widget settings)
⬜ Menus (translate once, save to cache)
`
3. Large Translation Strings:
`
Very long content takes time to retrieve
Consider splitting into smaller chunks
Or use lazy loading for below-fold content
`
4. Server Resources Insufficient:
`
Check server specs:
Consider upgrading hosting plan
`
5. No Object Cache:
`
THIS MAKES HUGE DIFFERENCE
Install Redis or Memcached
Can improve performance by 5-10x
Contact host to set up if not available
`
Prevention Tips
Best Practices
1. Set Up Monitoring:
`
Monitor:
Set alerts for anomalies
`
2. Regular Maintenance:
`
Monthly tasks:
Quarterly:
`
3. Proper Configuration:
`
✅ Cache enabled
✅ Object cache installed (Redis/Memcached)
✅ Appropriate cache duration
✅ Auto-cleanup enabled
✅ CDN configured correctly
✅ Monitoring in place
`
4. Test Before Production:
`
Test on staging site:
Only deploy to production after thorough testing
`
Getting Help
If cache issues persist:
– Cache statistics from dashboard
– Database table sizes
– Error log entries
– Server specifications
`
ShahiTranslate Pro → Tools → System Diagnostic
Download diagnostic report
`
– Include diagnostic report
– Describe issue and steps taken
– Mention hosting provider
– Specify if using object cache/CDN
Next Steps
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.