ShahiTranslate

Cache Issues Troubleshooting

Cache Not Storing Translations

Symptoms

    1. Every page load triggers new API call
    2. High API costs despite cache enabled
    3. Translation takes same time on repeat visits
    4. Cache statistics show 0% hit rate
    5. 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:
      `

    6. Clear all cache
    7. Visit a page in Spanish
    8. Check database: should see new rows in wpstptranslations
    9. Revisit same page: should load faster
    10. `

      Solutions

      Database Permission Issues:

    11. User needs INSERT, UPDATE, SELECT privileges
    12. Contact hosting provider to verify
    13. Or manually grant:
    14. `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:

    15. Check hosting disk quota
    16. Clean up old backups and files
    17. Upgrade hosting plan if needed
    18. Cache Plugin Conflict:

    19. Some caching plugins interfere with database writes
    20. Try temporarily disabling caching plugin
    21. If fixed, configure caching plugin to exclude:
    22. – Table: wpstptranslations
      – Database writes from caching

      Object Cache Misconfiguration:

    23. If using Redis/Memcached, verify it’s working:
    24. `php
      // Add to test file
      vardump(wpusingextobject_cache());
      // Should return true if object cache active
      `

    25. Reinstall object cache plugin if false
    26. Cache Serving Stale Content

      Symptoms

    27. Updated content still shows old translation
    28. Content edited but translation unchanged
    29. New content shows old translations
    30. Causes

    31. Cache not invalidating on content update
    32. Very long cache duration
    33. External caching layers not clearing
    34. 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:

    35. Cloudflare: Purge Everything or Purge by URL
    36. Other CDNs: Check their documentation
    37. Set up webhook for automatic CDN purge on content update
    38. Verify Cache Keys:
      `
      Settings → Advanced → Cache → Cache Key Components
      ✅ URL
      ✅ Language
      ✅ Post ID
      ✅ Last Modified Time (This is key!)
      `

      Cache Growing Too Large

      Symptoms

    39. Database size increasing rapidly
    40. Slow database queries
    41. “Disk quota exceeded” errors
    42. Site slowdown over time
    43. 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

    44. Cache hit rate = % of pages served from cache
    45. Should be 90%+ for good performance
    46. Low rate = frequent API calls, higher costs
    47. 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:

    48. Install Redis Object Cache Plugin:
    49. `
      Plugins → Add New → Search “Redis Object Cache”
      Install and activate
      Settings → Redis → Enable Object Cache
      `

    50. Check Redis Configuration:
    51. `php
      // In wp-config.php
      define(‘WPREDISHOST’, ‘127.0.0.1’);
      define(‘WPREDISPORT’, 6379);
      define(‘WPREDISPASSWORD’, ‘your-password’); // if set
      define(‘WPREDISDATABASE’, 0);
      `

    52. Restart Redis:
    53. `bash
      sudo service redis-server restart
      `

    54. Check Redis Memory:
    55. `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:
      `

    56. Install “Memcached Object Cache” plugin
    57. Copy object-cache.php to wp-content/
    58. Verify in Settings → Memcached
    59. `

      Common Issues:

    60. Memcached not installed on server (contact host)
    61. Wrong server address in configuration
    62. Firewall blocking connection
    63. Insufficient memory allocation
    64. CDN Caching Issues

      CDN Serving Wrong Language

      Symptoms:

    65. Spanish speakers see English
    66. Language switches but content doesn’t
    67. Random language appearing
    68. Cause: CDN not aware of language variations

      Solutions:

      Cloudflare:
      `

    69. Go to Caching → Configuration
    70. Cache Key: Custom
    71. Add Query String: lang
    72. Add Cookie: stp_language
    73. Purge Everything
    74. `

      KeyCDN:
      `
      Zone → Advanced Settings
      Cache Key: Enable
      Include Query Parameters: yes
      Add: lang parameter
      `

      Generic CDN:
      `
      Ensure cache key includes:

    75. URL with language (example.com/es/)
    76. Language cookie if using cookies
    77. Accept-Language header if auto-detecting
    78. `

      CDN Not Caching at All

      Check CDN Cache Status:
      `
      Browser DevTools → Network tab
      Look for X-Cache header:

    79. HIT = served from cache (good)
    80. MISS = not cached
    81. BYPASS = caching disabled for this request
    82. `

      Solutions:

    83. Enable Caching for HTML:
    84. `
      Most CDNs don’t cache HTML by default
      Enable in CDN settings
      Set appropriate cache duration (1 hour – 1 day)
      `

    85. Remove Cache-Busting Headers:
    86. `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;
      });
      `

    87. Set Correct Cache Rules:
    88. `
      CDN should cache:

    89. Pages with language parameter
    90. Static assets (CSS, JS, images)
    91. Flag images
    92. CDN should NOT cache:

    93. Admin pages
    94. Login pages
    95. Checkout/cart pages (if e-commerce)
    96. `

      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:

    97. PHP memory: Should be 256MB+
    98. MySQL connections: Sufficient for traffic
    99. CPU: Not constantly at 100%
    100. 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:

    101. Cache hit rate (weekly)
    102. Database size (monthly)
    103. API costs (daily if automatic translation)
    104. Page load times (weekly)
    105. Set alerts for anomalies
      `

      2. Regular Maintenance:
      `
      Monthly tasks:

    106. Clear cache older than 90 days
    107. Optimize database tables
    108. Review error logs
    109. Check disk space
    110. Quarterly:

    111. Review translation quality
    112. Update outdated translations
    113. Clean orphaned data
    114. `

      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:

    115. Cache functionality
    116. Performance with cache
    117. Cache clearing
    118. Multi-language caching
    119. Only deploy to production after thorough testing
      `

      Getting Help

      If cache issues persist:

    120. Gather Information:
    121. – Cache statistics from dashboard
      – Database table sizes
      – Error log entries
      – Server specifications

    122. Run Diagnostic:
    123. `
      ShahiTranslate Pro → Tools → System Diagnostic
      Download diagnostic report
      `

    124. Contact Support:
    125. – Include diagnostic report
      – Describe issue and steps taken
      – Mention hosting provider
      – Specify if using object cache/CDN

      Next Steps

    126. Performance Optimization
    127. Common Issues
    128. Translation Cache System

Share this article

Was this article helpful?

Help us improve our documentation

Still need help?

Our support team is ready to assist you with personalized guidance for your workspace.

Submit a support ticket