...

Source file src/github.com/lestrrat-go/httpcc/directives.go

Documentation: github.com/lestrrat-go/httpcc

     1  package httpcc
     2  
     3  type RequestDirective struct {
     4  	maxAge       *uint64
     5  	maxStale     *uint64
     6  	minFresh     *uint64
     7  	noCache      bool
     8  	noStore      bool
     9  	noTransform  bool
    10  	onlyIfCached bool
    11  	extensions   map[string]string
    12  }
    13  
    14  func (d *RequestDirective) MaxAge() (uint64, bool) {
    15  	if v := d.maxAge; v != nil {
    16  		return *v, true
    17  	}
    18  	return 0, false
    19  }
    20  
    21  func (d *RequestDirective) MaxStale() (uint64, bool) {
    22  	if v := d.maxStale; v != nil {
    23  		return *v, true
    24  	}
    25  	return 0, false
    26  }
    27  
    28  func (d *RequestDirective) MinFresh() (uint64, bool) {
    29  	if v := d.minFresh; v != nil {
    30  		return *v, true
    31  	}
    32  	return 0, false
    33  }
    34  
    35  func (d *RequestDirective) NoCache() bool {
    36  	return d.noCache
    37  }
    38  
    39  func (d *RequestDirective) NoStore() bool {
    40  	return d.noStore
    41  }
    42  
    43  func (d *RequestDirective) NoTransform() bool {
    44  	return d.noTransform
    45  }
    46  
    47  func (d *RequestDirective) OnlyIfCached() bool {
    48  	return d.onlyIfCached
    49  }
    50  
    51  func (d *RequestDirective) Extensions() map[string]string {
    52  	return d.extensions
    53  }
    54  
    55  func (d *RequestDirective) Extension(s string) string {
    56  	return d.extensions[s]
    57  }
    58  
    59  type ResponseDirective struct {
    60  	maxAge          *uint64
    61  	noCache         []string
    62  	noStore         bool
    63  	noTransform     bool
    64  	public          bool
    65  	private         []string
    66  	proxyRevalidate bool
    67  	sMaxAge         *uint64
    68  	extensions      map[string]string
    69  }
    70  
    71  func (d *ResponseDirective) MaxAge() (uint64, bool) {
    72  	if v := d.maxAge; v != nil {
    73  		return *v, true
    74  	}
    75  	return 0, false
    76  }
    77  
    78  func (d *ResponseDirective) NoCache() []string {
    79  	return d.noCache
    80  }
    81  
    82  func (d *ResponseDirective) NoStore() bool {
    83  	return d.noStore
    84  }
    85  
    86  func (d *ResponseDirective) NoTransform() bool {
    87  	return d.noTransform
    88  }
    89  
    90  func (d *ResponseDirective) Public() bool {
    91  	return d.public
    92  }
    93  
    94  func (d *ResponseDirective) Private() []string {
    95  	return d.private
    96  }
    97  
    98  func (d *ResponseDirective) ProxyRevalidate() bool {
    99  	return d.proxyRevalidate
   100  }
   101  
   102  func (d *ResponseDirective) SMaxAge() (uint64, bool) {
   103  	if v := d.sMaxAge; v != nil {
   104  		return *v, true
   105  	}
   106  	return 0, false
   107  }
   108  
   109  func (d *ResponseDirective) Extensions() map[string]string {
   110  	return d.extensions
   111  }
   112  
   113  func (d *ResponseDirective) Extension(s string) string {
   114  	return d.extensions[s]
   115  }
   116  
   117  
   118  

View as plain text