Skip to content

Commit

Permalink
Add ExpirationCacheResolver (#30)
Browse files Browse the repository at this point in the history
* Add ExpirationCacheResolver

* Add tests for SchemaCoordinatesMaxAgeProvider

* Add ClientAndServerSideExpirationTest

* Update API dump

* Introduce MaxAge and implement Apollo Server's behavior in SchemaCoordinatesMaxAgeProvider

* Add tests for SchemaCoordinatesMaxAgeProvider

* Fix broken test
  • Loading branch information
BoD authored Aug 21, 2024
1 parent 3494052 commit f94cd8d
Show file tree
Hide file tree
Showing 14 changed files with 819 additions and 98 deletions.
47 changes: 39 additions & 8 deletions normalized-cache-incubating/api/normalized-cache-incubating.api
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public final class com/apollographql/cache/normalized/NormalizedCache {
public static final fun getCacheHeaders (Lcom/apollographql/apollo/api/ApolloResponse;)Lcom/apollographql/cache/normalized/api/CacheHeaders;
public static final fun getCacheInfo (Lcom/apollographql/apollo/api/ApolloResponse;)Lcom/apollographql/cache/normalized/CacheInfo;
public static final fun isFromCache (Lcom/apollographql/apollo/api/ApolloResponse;)Z
public static final fun maxStale-HG0u8IE (Lcom/apollographql/apollo/api/MutableExecutionOptions;J)Ljava/lang/Object;
public static final fun memoryCacheOnly (Lcom/apollographql/apollo/api/MutableExecutionOptions;Z)Ljava/lang/Object;
public static final fun optimisticUpdates (Lcom/apollographql/apollo/ApolloCall;Lcom/apollographql/apollo/api/Mutation$Data;)Lcom/apollographql/apollo/ApolloCall;
public static final fun optimisticUpdates (Lcom/apollographql/apollo/api/ApolloRequest$Builder;Lcom/apollographql/apollo/api/Mutation$Data;)Lcom/apollographql/apollo/api/ApolloRequest$Builder;
Expand Down Expand Up @@ -270,8 +271,8 @@ public final class com/apollographql/cache/normalized/api/EmptyMetadataGenerator
public fun metadataForObject (Ljava/lang/Object;Lcom/apollographql/cache/normalized/api/MetadataGeneratorContext;)Ljava/util/Map;
}

public final class com/apollographql/cache/normalized/api/ExpireDateCacheResolver : com/apollographql/cache/normalized/api/CacheResolver {
public fun <init> ()V
public final class com/apollographql/cache/normalized/api/ExpirationCacheResolver : com/apollographql/cache/normalized/api/CacheResolver {
public fun <init> (Lcom/apollographql/cache/normalized/api/MaxAgeProvider;)V
public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object;
}

Expand Down Expand Up @@ -313,6 +314,35 @@ public abstract interface class com/apollographql/cache/normalized/api/FieldReco
public abstract fun mergeFields (Lcom/apollographql/cache/normalized/api/FieldRecordMerger$FieldInfo;Lcom/apollographql/cache/normalized/api/FieldRecordMerger$FieldInfo;)Lcom/apollographql/cache/normalized/api/FieldRecordMerger$FieldInfo;
}

public final class com/apollographql/cache/normalized/api/GlobalMaxAgeProvider : com/apollographql/cache/normalized/api/MaxAgeProvider {
public synthetic fun <init> (JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getMaxAge-5sfh64U (Lcom/apollographql/cache/normalized/api/MaxAgeContext;)J
}

public abstract interface class com/apollographql/cache/normalized/api/MaxAge {
}

public final class com/apollographql/cache/normalized/api/MaxAge$Duration : com/apollographql/cache/normalized/api/MaxAge {
public synthetic fun <init> (JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDuration-UwyO8pc ()J
}

public final class com/apollographql/cache/normalized/api/MaxAge$Inherit : com/apollographql/cache/normalized/api/MaxAge {
public static final field INSTANCE Lcom/apollographql/cache/normalized/api/MaxAge$Inherit;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/apollographql/cache/normalized/api/MaxAgeContext {
public fun <init> (Ljava/util/List;)V
public final fun getFieldPath ()Ljava/util/List;
}

public abstract interface class com/apollographql/cache/normalized/api/MaxAgeProvider {
public abstract fun getMaxAge-5sfh64U (Lcom/apollographql/cache/normalized/api/MaxAgeContext;)J
}

public final class com/apollographql/cache/normalized/api/MemoryCache : com/apollographql/cache/normalized/api/NormalizedCache {
public fun <init> ()V
public fun <init> (Lcom/apollographql/cache/normalized/api/NormalizedCache;IJ)V
Expand Down Expand Up @@ -391,11 +421,6 @@ public abstract interface class com/apollographql/cache/normalized/api/ReadOnlyN
public abstract fun loadRecords (Ljava/util/Collection;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Ljava/util/Collection;
}

public final class com/apollographql/cache/normalized/api/ReceiveDateCacheResolver : com/apollographql/cache/normalized/api/CacheResolver {
public fun <init> (I)V
public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object;
}

public final class com/apollographql/cache/normalized/api/Record : java/util/Map, kotlin/jvm/internal/markers/KMappedMarker {
public static final field Companion Lcom/apollographql/cache/normalized/api/Record$Companion;
public fun <init> (Ljava/lang/String;Ljava/util/Map;Ljava/util/UUID;)V
Expand Down Expand Up @@ -464,16 +489,22 @@ public final class com/apollographql/cache/normalized/api/RecordMergerKt {
}

public final class com/apollographql/cache/normalized/api/ResolverContext {
public fun <init> (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)V
public fun <init> (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Ljava/util/List;)V
public final fun getCacheHeaders ()Lcom/apollographql/cache/normalized/api/CacheHeaders;
public final fun getField ()Lcom/apollographql/apollo/api/CompiledField;
public final fun getFieldKeyGenerator ()Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;
public final fun getParent ()Ljava/util/Map;
public final fun getParentKey ()Ljava/lang/String;
public final fun getParentType ()Ljava/lang/String;
public final fun getPath ()Ljava/util/List;
public final fun getVariables ()Lcom/apollographql/apollo/api/Executable$Variables;
}

public final class com/apollographql/cache/normalized/api/SchemaCoordinatesMaxAgeProvider : com/apollographql/cache/normalized/api/MaxAgeProvider {
public synthetic fun <init> (Ljava/util/Map;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getMaxAge-5sfh64U (Lcom/apollographql/cache/normalized/api/MaxAgeContext;)J
}

public final class com/apollographql/cache/normalized/api/TypePolicyCacheKeyGenerator : com/apollographql/cache/normalized/api/CacheKeyGenerator {
public static final field INSTANCE Lcom/apollographql/cache/normalized/api/TypePolicyCacheKeyGenerator;
public fun cacheKeyForObject (Ljava/util/Map;Lcom/apollographql/cache/normalized/api/CacheKeyGeneratorContext;)Lcom/apollographql/cache/normalized/api/CacheKey;
Expand Down
Loading

0 comments on commit f94cd8d

Please sign in to comment.