roadrunner_esi

package module
v0.0.0-...-dfdfaa8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 0

README

Roadrunner middleware: Souin

This is a distributed HTTP cache module for Roadrunner based on Souin cache.

Features

Build the roadrunner binary

[velox]
build_args = ['-trimpath', '-ldflags', '-s -X github.com/roadrunner-server/roadrunner/v2/internal/meta.version=${VERSION} -X github.com/roadrunner-server/roadrunner/v2/internal/meta.buildTime=${TIME}']

[roadrunner]
ref = "master"

[github]
    [github.token]
    token = "GH_TOKEN"

    [github.plugins]
    logger = { ref = "master", owner = "roadrunner-server", repository = "logger" }
    cache = { ref = "master", owner = "darkweak", repository = "souin", folder = "/plugins/roadrunner" }
	# others ...

[log]
level = "debug"
mode = "development"

Example configuration

You can set each Souin configuration key under the http.cache key. There is a configuration example below.

# .rr.yaml
http:
  # Other http sub keys
  cache:
    api:
      basepath: /httpcache_api
      prometheus:
        basepath: /anything-for-prometheus-metrics
      souin: {}
    default_cache:
      allowed_http_verbs:
        - GET
        - POST
        - HEAD
      cdn:
        api_key: XXXX
        dynamic: true
        hostname: XXXX
        network: XXXX
        provider: fastly
        strategy: soft
      headers:
        - Authorization
      regex:
        exclude: '/excluded'
      timeout:
        backend: 5s
        cache: 1ms
      ttl: 5s
      stale: 10s
    log_level: debug
    ykeys:
      The_First_Test:
        headers:
          Content-Type: '.+'
      The_Second_Test:
        url: 'the/second/.+'
    surrogate_keys:
      The_First_Test:
        headers:
          Content-Type: '.+'
      The_Second_Test:
        url: 'the/second/.+'
  middleware:
    - cache
    # Other middlewares

Other resources

You can find an example for a docker-compose stack inside the examples folder.
See the Souin configuration for the full configuration, and its associated development roadrunner middleware

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configurer

type Configurer interface {
	// Get used to get config section
	Get(name string) any
	// Has checks if config section exists.
	Has(name string) bool
}

Configurer interface used to parse yaml configuration. Implementation will be provided by the RoadRunner automatically via Init method.

type Plugin

type Plugin struct{}

func (*Plugin) Init

func (p *Plugin) Init(cfg Configurer, log *zap.Logger) error

Init allows the user to set up an efficient esi processor.

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

Middleware is the request entrypoint to catch the response and process the esi tags if present.

func (*Plugin) Name

func (p *Plugin) Name() string

Name is the plugin name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL