cache

package
v1.0.0-SNAPSHOT...-0150756 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

provides an abstraction layer between callers, the caching system and the upstream API

func New

func New(upstream *mojang.MojangAPI, storage storage.StorageBackend) *Cache

creates a new cache client using

func (*Cache) BulkGetProfileId

func (c *Cache) BulkGetProfileId(names []string) ([]*entity.ProfileId, error)

resolves multiple profile associations at the current time

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) GetBlacklist

func (c *Cache) GetBlacklist() (*entity.Blacklist, error)

retrieves the current server blacklist

func (*Cache) GetNameHistory

func (c *Cache) GetNameHistory(id uuid.UUID) (*entity.NameChangeHistory, error)

retrieves the name history of a given profile

func (*Cache) GetProfile

func (c *Cache) GetProfile(id uuid.UUID) (*entity.Profile, error)

retrieves a single profile

func (*Cache) GetProfileId

func (c *Cache) GetProfileId(name string, at time.Time) (*entity.ProfileId, error)

retrieves the profile to which a given display name has been assigned at a specific time

func (*Cache) GetRateLimitAllocation

func (c *Cache) GetRateLimitAllocation() uint64

retrieves the amount of requests which have been submitted to the upstream servers within the last minute

func (*Cache) Login

func (c *Cache) Login(displayName string, serverId string, ip string) (*entity.Profile, error)

performs a cache assisted server login

func (*Cache) NewListener

func (c *Cache) NewListener() *Listener

registers a new event listener with the cache

func (*Cache) PurgeBlacklist

func (c *Cache) PurgeBlacklist() error

func (*Cache) PurgeNameHistory

func (c *Cache) PurgeNameHistory(id uuid.UUID) error

purges a name history from the cache

func (*Cache) PurgeProfile

func (c *Cache) PurgeProfile(id uuid.UUID) error

purges a specific profile from the cache

func (*Cache) PurgeProfileId

func (c *Cache) PurgeProfileId(name string, at time.Time) error

purges the profile association of a given name at a given time

type Listener

type Listener struct {
	C chan *entity.Event
	// contains filtered or unexported fields
}

func (*Listener) Close

func (e *Listener) Close()

frees all resources associated with this listener

Jump to

Keyboard shortcuts

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