> For the complete documentation index, see [llms.txt](https://aatkit.gitbook.io/aatkit-flutter-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aatkit.gitbook.io/aatkit-flutter-integration/formats/banner-cache.md).

# Banner Cache

### Create placement <a href="#markdown-header-creating-placement" id="markdown-header-creating-placement"></a>

Create `BannerCacheConfiguration` object and call `BannerCache.create` method to create banner cache:

```dart
final bannerCacheConfiguration = BannerCacheConfiguration(
  "BannerCacheFlutter",
  size: 2,
  listener: CacheListener(
    firstBannerLoaded: () =>
        print("[BannerCacheFlutter] firstBannerLoaded"),
  ),
);
_bannerCache =
    await BannerCache.create(configuration: bannerCacheConfiguration);
```

### Consume Banners

Next banner is consumed automatically when adding `AATKitCachedBanner` widget with passed `BannerCache` object as a parameter:

```dart
AATKitCachedBanner(
  bannerCache: _bannerCache,
  key: UniqueKey(),
)
```

### Destroy old banner

Banner is destroyed automatically when `AATKitBanner` widget is no longer attached to the UI.

### Destroy no longer needed BannerCache <a href="#markdown-header-destroy-no-longer-needed-bannercache" id="markdown-header-destroy-no-longer-needed-bannercache"></a>

For proper memory management, `BannerCache` needs to be destroyed when is no longer needed. The `destroy` method destroys the `BannerCache`:

```dart
_bannerCache.destroy();
```
