Need a method to clear the CEF cache.
And a possibility to set the maximum cache size would be the good feature too.
Need a method to clear the CEF cache.
And a possibility to set the maximum cache size would be the good feature too.
magreenblatt wrote:2. Clear the cache when CEF exists by using in-memory cache or by deleting the cache_path directory after CEF exits.
Are you experiencing a particular problem?
arabesc wrote:magreenblatt wrote:2. Clear the cache when CEF exists by using in-memory cache or by deleting the cache_path directory after CEF exits.
It's a simple and logical solution.
But it would be a better solution to have an opportunity to clear cache without shutting CEF down. It's not always convinient to do so while the application is still running.
To clarify: the main idea is to free disk space while the application is running.Are you experiencing a particular problem?
No, just want to give users more flexible controls.
magreenblatt wrote:What cache(s) are you interested in clearing? There are quite a few -- page, history, cookies, HTML5 storage (local, session, database), JavaScript, etc.
JRub wrote:Hello,
Is there a clean way of clearing HTTP session data?
I need to be able to remove session data on an on-demand basis without exiting CEF.
bioncube wrote:JRub wrote:Hello,
Is there a clean way of clearing HTTP session data?
I need to be able to remove session data on an on-demand basis without exiting CEF.
Did you find a good way to achieve this?
Is there a clean way of clearing HTTP session data?
I need to be able to remove session data on an on-demand basis without exiting CEF.
Did you find a good way to achieve this?
No.
I can remove session cookies with the cookie visitor, but nothing more.
CefCookieManager.Global.VisitAllCookies(new CefCookieVisitorImp());
public class CefCookieVisitorImp : CefCookieVisitor {
protected override bool Visit(CefCookie cookie, int count, int total, out bool delete) {
delete = true;
// Console.WriteLine(cookie.Domain + " " + cookie.Name + " " + cookie.Value);
return true;
}
}
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Threading;
namespace MistyMorningClearHistory
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string AppPath = Application.StartupPath + "\\";
if (args.Length == 0)
{
MessageBox.Show("No arguments to clear folder");
return;
}
bool DeleteCache = bool.Parse(args[0]);
bool DeleteIcons = bool.Parse(args[1]);
int ProcessID = int.Parse(args[2]);
Thread.Sleep(100);
if (ProcessID > 0)
{
try
{
Process P = Process.GetProcessById(ProcessID);
P.Kill();
}
catch { ;}
}
Thread.Sleep(600);
if (DeleteIcons) ClearHistory(AppPath + "Icons", 0, false);
if (DeleteCache) ClearHistory(AppPath + "Cache", 0, false);
}
public static void ClearHistory(string Path, int Depth, bool IncludeLog)
{//Chance some of the files are locked
DirectoryInfo DInfo = new DirectoryInfo(Path);
foreach (FileInfo FInfo in DInfo.GetFiles())
{
if (IncludeLog || FInfo.Name.ToLower() != "debug.log")//We delete this file on start-up
{ try { FInfo.Delete(); } catch { ;} }
}
foreach (DirectoryInfo DInfoSub in DInfo.GetDirectories())
{
ClearHistory(DInfoSub.FullName, Depth + 1, IncludeLog);
}
if (Depth > 1) try { DInfo.Delete(); }
catch { ;}
}
}
}
Return to Feature Request Forum
Users browsing this forum: No registered users and 23 guests