Forum Discussion

Leo's avatar
Icon for Nimbostratus rankNimbostratus
Jun 30, 2011

Clearing the cache

Hi everyone, sorry for the newbie question :)



I'm managing a BIG-IP 9.4.7 Build 320.1 for a customer of mine, and sometimes I need to delete the cache by running:


"b profile http http-wan-optimized-compression-caching ramcache entry all delete" in the CLI.




I'd like to make an executable for him that runs the above command, so that he wont have to call me every few days.


I thought of using C to keep the credentials hidden.




I's appreciate if anyone could point to some examples doing something similar?



6 Replies

  • Hi all


    i have this Q


    if i wiil use this content


    will it do the work for the "b profile http http-wan-optimized-compression-caching ramcache entry all delete" in the CLI..


    do you think it will keep the credentials hidden ? ?




    <%@ Page Language="C" AutoEventWireup="true" CodeBehind="ssh.aspx.cs" Inherits="activesocketcsharp.ssh" %>







    ActiveSocket ASP .NET C Sample - SSH





    ActiveSocket ASP .NET C Sample - SSH



    <form> id="form1" runat="server">


    Remote Host:



    Private Key File:









    Standard Output:




    Result code:



    Run command:





    Style="z-index: 119; left: 23px; position: absolute; top: 584px" Width="148px">Return to index page


    Timeout (msecs):







    Standard Error:










  • Leonid and Alakata,



    I would suggest investigating using iControl to look at and clear the RamCache ( I plan on doing the same thing but haven’t had the opportunity to do it yet, but I would suggest doing it via a Website and have the Credentials (because the account would need elevated permissions and is not something you would want to release into the wild) contained within the app.config / web.config which remain in a controlled server environment away from the user.



    Best practices would to never release an account in any way, even if it is compiled within an application since it could still be captured and misused.
  • Leo's avatar
    Icon for Nimbostratus rankNimbostratus
    Just an update,


    I've made a small C app that run's PLINK (the CLI version of PUTTY) and using a command promt it opens an SSH connection the BIGIP linux shell and runs a shell-script i've stored on the machine itself that cleans the cache.
  • I had made a C app to do this, I can post some code for how to perform the action if you'd like?



  • Here 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;
                    // 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;
  • Leo's avatar
    Icon for Nimbostratus rankNimbostratus
    Could've used that a couple of months ago 🙂 I simply use external program for the SSH so it makes it easy:

    using System;
    using System.Diagnostics;
    class Program
        static void Main()
            RunScript(@"-ssh -pw PASS root@IP /var/tmp/");
        static void RunScript(string f)
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = "plink.exe";
            startInfo.Arguments = f;