From d32f62047a135bf92a084453a464e9724101a918 Mon Sep 17 00:00:00 2001
From: Seblu <sebastien.luttringer@smartjog.com>
Date: Tue, 8 Feb 2011 11:36:20 +0100
Subject: [PATCH] add command cache

---
 cccli/command/__init__.py |  1 +
 cccli/command/cache.py    | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 cccli/command/cache.py

diff --git a/cccli/command/__init__.py b/cccli/command/__init__.py
index 080918c..00546ee 100644
--- a/cccli/command/__init__.py
+++ b/cccli/command/__init__.py
@@ -18,3 +18,4 @@ from cccli.command.vm import *
 # by command module
 from cccli.command.list import Command_list
 from cccli.command.expert import Command_expert
+from cccli.command.cache import Command_cache
diff --git a/cccli/command/cache.py b/cccli/command/cache.py
new file mode 100644
index 0000000..01a4063
--- /dev/null
+++ b/cccli/command/cache.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+#coding=utf8
+
+'''
+CloudControl cache command
+'''
+from cccli.exception import *
+from sjrpc.core.exceptions import *
+from cccli.printer import Printer, color
+from cccli.command.command import Command
+
+class Command_cache(Command):
+    '''Show server cache statistics'''
+
+    def __call__(self, argv):
+        try:
+            d = self.cli.rpc.call("dbstats")
+            for i,v in d.items():
+                self.printer.out("%s: %s"%(i,v))
+        except RpcError as e:
+            raise cmdError("RPCError: %s"%str(e))
-- 
GitLab