Merge: Safe call operator
[nit.git] / lib / github / cache.nit
index 82d102a..dbb4ad0 100644 (file)
@@ -28,9 +28,9 @@
 #
 # var name = "nitlang/nit"
 # assert not api.has_cache(name)
-# var repo = api.load_repo(name) # load from GitHub
+# var repo = api.get_repo(name) # load from GitHub
 # #assert api.has_cache(name) FIXME bring back this assert
-# repo = api.load_repo(name) # load from cache
+# repo = api.get_repo(name) # load from cache
 #
 # api.clear_cache
 # assert not api.has_cache(name)
@@ -58,9 +58,9 @@ redef class GithubAPI
        redef fun get(key, headers, data) do
                if not enable_cache then return super
                if store.has_key(key) then
-                       message(1, "Get {key} (cache)")
+                       # print "Get {key} (cache)" # debug
                        was_error = false
-                       return deserialize(store.load_object(key).to_json).as(nullable GithubEntity)
+                       return deserialize(store.load_object(key).to_json)
                end
                var obj = super
                if not was_error and obj isa Serializable then
@@ -71,7 +71,7 @@ redef class GithubAPI
 
        # Save `json` data in cache under `key`.
        private fun cache(key: String, obj: Serializable) do
-               message(2, "Cache key {key}")
+               # print "Cache key {key}" # debug
                store.store_object(key, obj.to_json.parse_json.as(JsonObject))
        end