Skip to content

Commit edfcd83

Browse files
Doc comments for Settings
1 parent 2b90b52 commit edfcd83

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Sources/Cache/CacheSettings.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,32 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
/// Specifies the cache configuration for a Firebase Data Connect instance
15+
/// Specifies the cache configuration for a `DataConnect` instance.
16+
///
17+
/// You can configure the cache's storage policy and its maximum size.
1618
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
1719
public struct CacheSettings: Sendable {
20+
/// Defines the storage mechanism for the cache.
1821
public enum Storage: Sendable {
22+
/// The cache will be written to disk, persisting data across application launches.
1923
case persistent
24+
/// The cache will only be stored in memory and will be cleared when the application terminates.
2025
case memory
2126
}
2227

23-
public let storage: Storage // default provider is persistent type
28+
/// The storage mechanism to be used for caching. The default is `.persistent`.
29+
public let storage: Storage
30+
/// The maximum size of the cache in bytes.
31+
///
32+
/// This size is not strictly enforced but is used as a guideline by the cache
33+
/// to trigger cleanup procedures. The default is 100MB (100,000,000 bytes).
2434
public let maxSizeBytes: UInt64
2535

36+
/// Creates a new cache settings configuration.
37+
///
38+
/// - Parameters:
39+
/// - storage: The storage mechanism to use. Defaults to `.persistent`.
40+
/// - maxSize: The maximum desired size of the cache in bytes. Defaults to 100MB.
2641
public init(storage: Storage = .persistent, maxSize: UInt64 = 100_000_000) {
2742
self.storage = storage
2843
maxSizeBytes = maxSize

0 commit comments

Comments
 (0)