Forum Archive - Too much bandwidth with database + cache problem

Too much bandwidth with database + cache problem
Nov 15, 2010 5:25 pm by machabeus
I have 2 problems with GTranslate. The first one is too much data tranfered with database generated by GTranslate (average is 20-30GB per day, at 500 visitors a day), and the second problem is with cache. It is generated milions of files, and do not delete it. So my small site is generating about 2-3 milions of files per week. What more information are needed ?
Re: Too much bandwidth with database + cache problem
Nov 16, 2010 9:13 am by Edvard
It doesn't transfer data through your database. It saves the cache files in the file system. Probably you have many URLs and search engines are indexing your site translations, that's why it grows that fast. You can put this code in your gtranslate/config.php to enable self clear function of the cached files. define('MAINLANG', 'en'); if(rand() % 20 == 0) { // purge expired cache $cached_files = array_diff(scandir('cache'), array('.', '..')); $now = strtotime('now'); foreach($cached_files as $cached_file) if($now - filemtime('cache/'.$cached_file) > 1.5 * CACHETIME) unlink('cache/'.$cached_file); } ...
Re: Too much bandwidth with database + cache problem
Dec 16, 2010 7:55 pm by pert7
I have the same problem with the cache! If I put this code in config.php, how often will be cleared the cache directory? May I get an error 302 with this configuration?
Re: Too much bandwidth with database + cache problem
Dec 17, 2010 5:54 pm by pert7
Can you support me please? I bought this product..
Re: Too much bandwidth with database + cache problem
Dec 20, 2010 1:14 pm by Edvard
Hi, the cache folder will be cleared 1.5 times the cache time specified in config.php file. By default it is set to 20 days. If you don't decrease the cache time and you have an average website with 1000 visitors a day you will not get that error.
Re: Too much bandwidth with database + cache problem
Dec 20, 2010 4:13 pm by pert7
I have 1000-2000 visitors per day and I hope do not have this problem. Is it right the position of the code? Thank you very much! <?php define('LICENSE', 'license.dat'); define('CACHETIME', 82600); //20 days define('MAINLANG', 'el'); // en, ar, bg, hr, cn, ct, cs, da, et, tl, fi, fr, gl, el, iw, hi, es, nl, id, ja, ca, ko, lt, lv, mt, de, no, pt, ru, ro, sr, sk, sl, sv, th, tr, uk, hu, vi, it, pl, sq if (!function_exists('file_put_contents')) { function file_put_contents($filename, $data) { $f = @fopen($filename, 'w'); if (!$f) { return false; } else { $bytes = fwrite($f, $data); fclose($f); return $bytes; } } } if (!function_exists('file_get_contents')) { // Define function and arguments function file_get_contents($file, $include=false) { // Varify arguments are correct types if (!is_string($file)) return(false); if (!is_bool($include)) return(false); // Open the file with givin options if (!$handle = @fopen($file, 'rb', $include)) return(false); // Read data from file $contents = fread($handle, filesize($file)); // Close file fclose($handle); // Return contents of file return($contents); } } define('MAINLANG', 'el'); if(rand() % 20 == 0) { // purge expired cache $cached_files = array_diff(scandir('cache'), array('.', '..')); $now = strtotime('now'); foreach($cached_files as $cached_file) if($now - filemtime('cache/'.$cached_file) > 1.5 * CACHETIME) unlink('cache/'.$cached_file); } Also, I receive this javascript error in IE: The 'window.jstiming.load' είναι μηδενικό ή δεν είναι αντικείμενο line: 193 Character: 478 Code: 0 URI: http://translate.googleusercontent.com/translate/static/biEfM_qFbxU/js/translate_c.js
Re: Too much bandwidth with database + cache problem
Jan 5, 2011 10:17 pm by pert7
Unfortunately, the error 302 message appeared again!! The code don't helps... :-(

SIMILAR TOPICS

Joomshaper Pagebuilder buttons Link edit problemJan 11, 2019 10:04 amReplies: 1Post by: kumatest
Problem with pluginDec 30, 2018 11:59 pmReplies: 1Post by: Iyari
Problem of translation in my websiteDec 8, 2018 12:15 pmReplies: 1Post by: Ibrahim
Problem with qTranslate-x, please help!Aug 22, 2018 9:14 amReplies: 1Post by: sadammkhan
2 questions: w3 total cache and paymentAug 19, 2018 10:38 amReplies: 2Post by: Wind777

Try GTranslate with a free 15 day trial