[2.7] Travis: use ccache (GH-3307) (#3333)

(cherry picked from commit 8adc73c)
diff --git a/.travis.yml b/.travis.yml
index d73cb9e..571dd04 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,10 @@
 sudo: false
 group: beta
 
-# To cache doc-building dependencies.
-cache: pip
+# To cache doc-building dependencies and C compiler output.
+cache:
+    - pip
+    - ccache
 
 branches:
   only: