Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Protected Member Functions | Friends
net_instaweb::PropertyPage Class Reference

#include "property_cache.h"

Inheritance diagram for net_instaweb::PropertyPage:
net_instaweb::MockPropertyPage net_instaweb::PropertyCallback net_instaweb::ProxyFetchPropertyCallback

List of all members.

Classes

struct  PropertyMapStruct

Public Member Functions

virtual PropertyValueGetProperty (const PropertyCache::Cohort *cohort, const StringPiece &property_name) const
virtual void UpdateValue (const PropertyCache::Cohort *cohort, const StringPiece &property_name, const StringPiece &value)
virtual void WriteCohort (const PropertyCache::Cohort *cohort)
CacheInterface::KeyState GetCacheState (const PropertyCache::Cohort *cohort)
void set_cache_state_for_tests (const PropertyCache::Cohort *cohort, CacheInterface::KeyState x)
void DeleteProperty (const PropertyCache::Cohort *cohort, const StringPiece &property_name)
const GoogleStringkey () const
LogRecordlog_record ()
virtual void LogPageCohortInfo (LogRecord *log_record, int cohort_index)
 Adds logs for the given PropertyPage to the specified cohort info index.

Protected Member Functions

 PropertyPage (const StringPiece &key, const RequestContextPtr &request_context, AbstractMutex *mutex, PropertyCache *property_cache)
 The Page takes ownership of the mutex.
virtual bool IsCacheValid (int64 write_timestamp_ms) const
virtual void Done (bool success)=0
 Called as a result of PropertyCache::Read when the data is available.

Friends

class CallbackCollector
class PropertyCache::CacheInterfaceCallback
class PropertyCache

Detailed Description

Holds the property values associated with a single key. See more extensive comment for PropertyPage above.


Member Function Documentation

void net_instaweb::PropertyPage::DeleteProperty ( const PropertyCache::Cohort cohort,
const StringPiece &  property_name 
)

Deletes a property given the property name.

This function deletes the PropertyValue if it already exists, otherwise it is a no-op function.

It is a programming error to call DeleteProperty on a PropertyPage that has not yet been read.

This function actually does not commit it to cache.

This function returns the cache state for a given cohort.

It is a programming error to call GetCacheState on a PropertyPage that has not yet been read.

virtual PropertyValue* net_instaweb::PropertyPage::GetProperty ( const PropertyCache::Cohort cohort,
const StringPiece &  property_name 
) const [virtual]

Gets a property given the property name. The property can then be mutated, prior to the PropertyPage being written back to the cache.

The returned PropertyValue object is owned by the PropertyPage and should not be deleted by the caller.

This function creates the PropertyValue if it didn't already exist, either from a previous call or a cache-read.

It is a programming error to call GetProperty on a PropertyPage that has not yet been read.

Note that all the properties in all the Cohorts on a Page are read via PropertyCache::Read. This allows cache implementations that support batching to do so on the read. However, properties are written back to cache one Cohort at a time, via PropertyCache::WriteCohort.

virtual bool net_instaweb::PropertyPage::IsCacheValid ( int64  write_timestamp_ms) const [inline, protected, virtual]

Called immediatly after the underlying cache lookup is done, from PropertyCache::CacheInterfaceCallback::Done().

Reimplemented in net_instaweb::ProxyFetchPropertyCallback, and net_instaweb::MockPropertyPage.

This function set the cache state for a given cohort. This is only for test code. Normally, cache state should be always set by cache, not from this function.

It is a programming error to call set_cache_state_for_tests on a PropertyPage that has not yet been read.

virtual void net_instaweb::PropertyPage::UpdateValue ( const PropertyCache::Cohort cohort,
const StringPiece &  property_name,
const StringPiece &  value 
) [virtual]

Updates the value of a property, tracking stability & discarding writes when the existing data is more up-to-date.

virtual void net_instaweb::PropertyPage::WriteCohort ( const PropertyCache::Cohort cohort) [virtual]

Updates a Cohort of properties into the cache. It is a programming error (dcheck-fail) to Write a PropertyPage that was not read first. It is fine to Write after a failed Read.

Even if a PropertyValue was not changed since it was read, Write should be called periodically to update stability metrics.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines