Forum Discussion
Leo
Nimbostratus
Jun 30, 2011Clearing the cache
Hi everyone, sorry for the newbie question :)
I'm managing a
BIG-IP 9.4....
Hugh123
Nimbostratus
Aug 18, 2011Here is the code I have. I went down the route of attempting to ssh and do this, but it's rather difficult and not worth it. If you use the iControl API, it makes things much easier.
using iControl;
protected void GetRamCacheInfo(object sender, EventArgs e)
{
// Declare local variables
LocalLBRAMCacheInformationRAMCacheKey prof_key = new LocalLBRAMCacheInformationRAMCacheKey();
LocalLBRAMCacheInformationRAMCacheKey[] keys = new LocalLBRAMCacheInformationRAMCacheKey[] { prof_key };
LocalLBRAMCacheInformationRAMCacheEntry[][] entries = null;
// Set other variables
ipAddress = System.Configuration.ConfigurationManager.AppSettings["TestRamCacheClear"];
user = GetUserID();
pass = TextBox1.Text;
try
{
// Instantiate and initialize interface
Interfaces m_interfaces = new Interfaces();
m_interfaces.initialize(ipAddress, user, pass);
// Set RamCache keys
prof_key.host_name = "";
prof_key.maximum_responses = 500;
prof_key.profile_name = profilesList.SelectedItem.ToString(); //--> I have this set to a drop down, could be text box, or list box
prof_key.uri = "";
if (m_interfaces.initialized)
{
string[] HTTPinfo = m_interfaces.LocalLBProfileHttp.get_list();
entries = m_interfaces.LocalLBRAMCacheInformation.get_ramcache_entry(keys);
Entries.Visible = true;
entrieslbl.Text = entries[0].Length.ToString();
for (int i = 0; i < HTTPinfo.Length; i++)
{
if (HTTPinfo[i] == prof_key.profile_name)
{
m_interfaces.LocalLBRAMCacheInformation.evict_ramcache_entry_v2(keys, false);
}
}
entries = m_interfaces.LocalLBRAMCacheInformation.get_ramcache_entry(keys);
if (entries[0].Length == 0)
{
RamCachelbl.Text = "RAM cache cleared";
RamCachelbl.ForeColor = Color.Green;
}
}
}
catch (Exception x)
{
RamCachelbl.Text = x.Message + "\nSTACK: " + x.StackTrace;
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects