@@ -140,7 +140,12 @@ reports `True`.
140
140
141
141
Crossplane calls a Function to determine what resources it should create when
142
142
you create a composite resource. The Function also tells Crossplane what to do
143
- with these resources when you update or delete a composite resource.
143
+ with these resources when you update a composite resource.
144
+
145
+ {{<hint "note" >}}
146
+ Composition functions don't run when you delete a composite resource.
147
+ Crossplane handles deletion of composed resources automatically.
148
+ {{< /hint >}}
144
149
145
150
When Crossplane calls a Function it sends it the current state of the composite
146
151
resource. It also sends it the current state of any resources the composite
@@ -576,7 +581,7 @@ sequenceDiagram
576
581
Crossplane Pod->>+API Server: Apply desired composed resources
577
582
` ` `
578
583
579
- When you create, update, or delete a composite resource that uses composition
584
+ When you create or update a composite resource that uses composition
580
585
functions Crossplane calls each function in the order they appear in the
581
586
Composition's pipeline. Crossplane calls each function by sending it a gRPC
582
587
RunFunctionRequest. The function must respond with a gRPC RunFunctionResponse.
@@ -769,3 +774,35 @@ that isn't desired state. Functions can use context for this. Any function can
769
774
write to the pipeline context. Crossplane passes the context to all following
770
775
functions. When Crossplane has called all functions it discards the pipeline
771
776
context.
777
+
778
+ # ## Function response cache
779
+
780
+ {{<hint "note" >}}
781
+ Function response caching is an alpha feature. Enable it by setting the
782
+ ` --enable-function-response-cache` feature flag.
783
+ {{< /hint >}}
784
+
785
+ Crossplane can cache function responses to improve performance by reducing
786
+ repeated function calls. When enabled, Crossplane caches responses from
787
+ composition functions that include a Time-To-Live (TTL) value.
788
+
789
+ The cache works by :
790
+ - Storing function responses on disk based on a hash of the request
791
+ - Only caching responses with a non-zero TTL
792
+ - Automatically removing expired cache entries
793
+ - Reusing cached responses for identical requests until they expire
794
+
795
+ This feature is particularly useful for functions that :
796
+ - Perform expensive computations or external API calls
797
+ - Return stable results for the same inputs
798
+ - Include appropriate TTL values in their responses
799
+
800
+ # ### Cache configuration
801
+
802
+ Control the cache behavior with these Crossplane pod arguments :
803
+
804
+ - `--xfn-cache-max-ttl` - Maximum cache duration (default : 24 hours)
805
+
806
+ The cache stores files in the `/cache/xfn/` directory within the Crossplane pod.
807
+ For better performance, consider using an in-memory cache by mounting an
808
+ emptyDir volume with `medium : Memory`.
0 commit comments