# Clear Cache - Admin

<% ' Admin utility to clear all cache (Zabbix, Dropdowns, Lists) ' Usage: adminclearcache.asp?confirm=yes&type=all|zabbix|dropdown|list %>

## Cache Management

<% Dim confirm, cacheType, redirectPage, printerIP confirm = Request.QueryString("confirm") cacheType = Request.QueryString("type") redirectPage = Request.QueryString("redirect") printerIP = Trim(Request.QueryString("printerip") & "") If cacheType = "" Then cacheType = "all" If confirm = "yes" Then ' Clear selected cache Select Case cacheType Case "printer" If printerIP <> "" Then Call ClearPrinterCache(printerIP) Response.Write("
Success: Cache cleared for printer: " & Server.HTMLEncode(printerIP) & "
") Else Response.Write("
Error: No printer IP specified.
") End If Case "zabbix" Call ClearAllZabbixCache() Response.Write("
Success: All Zabbix cache cleared (all printers).
") Case "dropdown" Call ClearDropdownCache() Response.Write("
Success: Dropdown cache cleared.
") Case "list" Call ClearListCache() Response.Write("
Success: List cache cleared.
") Case Else Call ClearAllZabbixCache() Call ClearAllDataCache() Response.Write("
Success: All cache cleared.
") End Select ' Redirect if specified, otherwise show link If redirectPage <> "" Then Response.Write("") Response.Write("

Redirecting back to report...

") Else Response.Write("
View Printers") End If Else ' Show cache statistics Dim key, zabbixCount, dropdownCount, listCount zabbixCount = 0 dropdownCount = 0 listCount = 0 For Each key In Application.Contents If Right(key, 5) <> "_time" And Right(key, 11) <> "_refreshing" Then If Left(key, 7) = "zabbix_" Then zabbixCount = zabbixCount + 1 If Left(key, 9) = "dropdown_" Then dropdownCount = dropdownCount + 1 If Left(key, 5) = "list_" Then listCount = listCount + 1 End If Next Response.Write("

Current cache status:

") Response.Write("

") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
Cache Type | Items | Description | Action
--- | --- | --- | ---
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
Zabbix Data (All Printers) | " & zabbixCount & " | Toner levels, printer status for all printers | Clear All
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
Dropdowns | " & dropdownCount & " | Vendors, models (cached 1 hour) | Clear
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
") Response.Write("
Lists | " & listCount & " | Printer lists (cached 5 min) | Clear
") Response.Write("

") ' Add form for individual printer cache clearing Response.Write("
") Response.Write("Clear Individual Printer Cache") Response.Write("

To clear cache for a specific printer, enter its IP address:

") Response.Write("") Response.Write("") Response.Write("") Response.Write("
") Response.Write("Printer IP Address:") Response.Write("") Response.Write("
") Response.Write("
") Response.Write("") Response.Write("
") Response.Write("
") Response.Write("Note: Clearing cache will cause slower page loads until cache rebuilds.") Response.Write("
") Response.Write("
") Response.Write("Clear ALL Cache ") Response.Write("Cancel") End If %>
← Back to Home