\duncan3dc\Sonos\DevicesCachedCollection

Cache the collection of devices.

Summary

Methods
Properties
Constants
__construct()
setLogger()
getLogger()
addDevice()
addIp()
getDevices()
clear()
No public properties found
CACHE_KEY
No protected methods found
No protected properties found
N/A
clearCache()
$retrieved
$collection
$cache
N/A

Constants

CACHE_KEY

CACHE_KEY = "device-ip-addresses"

Properties

$retrieved

$retrieved : boolean

Type

boolean — A flag to indicate whether we've retrieved the devices from cache yet or not.

$cache

$cache : \Psr\SimpleCache\CacheInterface

Type

\Psr\SimpleCache\CacheInterface — The cache object to use for finding Sonos devices on the network.

Methods

__construct()

__construct(\duncan3dc\Sonos\Interfaces\Devices\CollectionInterface  $collection, \Psr\SimpleCache\CacheInterface  $cache) 

Create a new instance.

Parameters

\duncan3dc\Sonos\Interfaces\Devices\CollectionInterface $collection

The device collection to actually use

\Psr\SimpleCache\CacheInterface $cache

The cache object to use

setLogger()

setLogger(\Psr\Log\LoggerInterface  $logger) : $this

Set the logger object to use.

Parameters

\Psr\Log\LoggerInterface $logger

Returns

$this

getLogger()

getLogger() : \Psr\Log\LoggerInterface

Get the logger object to use.

Returns

\Psr\Log\LoggerInterface —

$logger The logging object

addIp()

addIp(string  $address) : $this

Add a device to this collection using its IP address

Parameters

string $address

The IP address of the device to add

Returns

$this

clear()

clear() : $this

Remove all devices from this collection.

Returns

$this

clearCache()

clearCache() : void

Remove any cached data we have.