Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compressed_cache.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef PAGESPEED_KERNEL_CACHE_COMPRESSED_CACHE_H_
20 #define PAGESPEED_KERNEL_CACHE_COMPRESSED_CACHE_H_
21 
26 #include "pagespeed/kernel/cache/cache_interface.h"
27 
28 namespace net_instaweb {
29 
30 class Histogram;
31 class Statistics;
32 class Variable;
33 
36  public:
39  virtual ~CompressedCache();
40 
41  static void InitStats(Statistics* stats);
42 
43  virtual void Get(const GoogleString& key, Callback* callback);
44  virtual void Put(const GoogleString& key, const SharedString& value);
45  virtual void Delete(const GoogleString& key);
46  virtual GoogleString Name() const { return FormatName(cache_->Name()); }
47  static GoogleString FormatName(StringPiece cache);
48  virtual CacheInterface* Backend() { return cache_; }
49  virtual bool IsBlocking() const { return cache_->IsBlocking(); }
50  virtual bool IsHealthy() const;
51  virtual void ShutDown();
52 
55  int64 CorruptPayloads() const;
56 
59  int64 OriginalSize() const;
60 
63  int64 CompressedSize() const;
64 
65  private:
66  CacheInterface* cache_;
67  Histogram* compressed_cache_savings_;
68  Variable* corrupt_payloads_;
69  Variable* original_size_;
70  Variable* compressed_size_;
71 
72 
73 };
74 
75 }
76 
77 #endif
Abstract interface for a cache.
Definition: cache_interface.h:32
Definition: statistics.h:43
virtual void Get(const GoogleString &key, Callback *callback)
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Compressed cache adapter.
Definition: compressed_cache.h:35
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual void Put(const GoogleString &key, const SharedString &value)
virtual bool IsBlocking() const =0
Definition: shared_string.h:40
virtual bool IsHealthy() const
virtual CacheInterface * Backend()
Definition: compressed_cache.h:48
Definition: cache_interface.h:42
Definition: statistics.h:138
virtual GoogleString Name() const =0
virtual GoogleString Name() const
Definition: compressed_cache.h:46
CompressedCache(CacheInterface *cache, Statistics *stats)
Does not takes ownership of cache or stats.
virtual bool IsBlocking() const
Definition: compressed_cache.h:49