# Understanding perspective playback control from Ignition Exchange

**URL:** <https://forum.inductiveautomation.com/t/understanding-perspective-playback-control-from-ignition-exchange/30255>\
**Category:** Ignition\
**Created:** [November 26, 2019, 9:46pm UTC](https://forum.inductiveautomation.com/t/understanding-perspective-playback-control-from-ignition-exchange/30255 "2019-11-26T21:46:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bojacobsen](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bojacobsen](https://forum.inductiveautomation.com/u/Bojacobsen)\
**Post date:** [November 26, 2019, 9:46pm UTC](https://forum.inductiveautomation.com/t/understanding-perspective-playback-control-from-ignition-exchange/30255/1 "2019-11-26T21:46:51Z")

</div>

Hello All

I was trying to reuse the Historical Playback Control from Ignition Exchange.

It works 😀 but I don’t understand all of it 😰. I don’t understand how

`if currentTimeString in cache:`

can be true.

in this part:

```auto
globals = system.util.getGlobals()
		
		if 'playbackCache' not in globals:
			globals['playbackCache'] = {}
		cache = globals['playbackCache']
		if currentTimeString in cache:
			#self.custom.debug = "stringInCache"
			row = cache[currentTimeString]
			foundAll = True
			for tag in tags:
				if (tag.split("]")[1] if len(tag.split("]"))>1 else tag).replace("/","_").replace(" ","_") not in row:
					foundAll = False
			if foundAll:
				# Cache Hit
				info += "Cache hit. "
				self.params.values = row

if not 'foundAll' in vars() or foundAll == False:
			# Cache Miss
			info += "Cache miss. "
			#self.custom.debug = foundAll
			
			# Set the length of the cache retrieval:
			seconds = 10
			
			# Grab the values from the current second
			dataset = system.tag.queryTagHistory([tag for tag in tags], currentTimeDate, system.date.addSeconds(currentTimeDate, seconds), seconds)
			pyDataset = system.dataset.toPyDataSet(dataset)
			columns = pyDataset.getColumnNames()
			
			# Make sure the cache isn't too big. If it is, dump it.
			if len(cache) > 10000:
				cache = {}
			
			for row in pyDataset:
				values = {}
				timeStampString = ""
				for i in range(len(columns)):
					if columns[i] == "t_stamp":
						timeStampString = "T"+system.date.format(row[i], "yyyy-MM-dd HH-mm-ss").replace(" ", "T")
					else:
						values[columns[i].replace("/","_").replace(" ","_")] = row[i]
				cache[timeStampString] = values

			self.params.values = cache[currentTimeString]

```

How does currentTimeString get into cache.

I hope you guys can help me and understand the use of globals in this case.

---

<div class="post-metadata">

**Author:** ![Bojacobsen](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bojacobsen](https://forum.inductiveautomation.com/u/Bojacobsen)\
**Post date:** [November 27, 2019, 9:35pm UTC](https://forum.inductiveautomation.com/t/understanding-perspective-playback-control-from-ignition-exchange/30255/2 "2019-11-27T21:35:26Z")

</div>

When i try to turn on the “turnOnGaterwayLogger”

The Message is all the time “Cache miss”.

Tick: Historical mode. Time: T2019-11-27T21-35-55 Cache miss. Total time: 13
